Giter Site home page Giter Site logo

If a mesh does not intersect the cutting plane it would be nice if I was told if it was on the upper or lower side. about ezy-slice HOT 3 CLOSED

davidarayan avatar davidarayan commented on July 23, 2024
If a mesh does not intersect the cutting plane it would be nice if I was told if it was on the upper or lower side.

from ezy-slice.

Comments (3)

DavidArayan avatar DavidArayan commented on July 23, 2024

Hello @The-MAZZTer,

Have a look at https://github.com/DavidArayan/ezy-slice/blob/master/EzySlice/Framework/Plane.cs#L83. This function takes a Vector3 and lets you know which side of the plane the point is on.

Since you already have a Plane object (needed to make cuts) you can perform this test on the application side. The code will follows.

  1. Perform the slice operation using a Plane
  2. If the slice is null, grab a random vertex (maybe first point?) from the mesh you were trying to cut.
  3. Test this point against myPlane.SideOf(myVertex) which will return SideOfPlane.UP, SideOfPlane.DOWN or SideOfPlane.ON

from ezy-slice.

The-MAZZTer avatar The-MAZZTer commented on July 23, 2024

I am using UnityEngine.Plane.GetSide which does the same thing and I have that working. Not sure why you have your own Plane class but I haven't looked at it; I assume there is a good reason though.

I pretty much did what you described. I just think it would be nice to not have to do that extra step since the .Slice function has that information anyway.

from ezy-slice.

DavidArayan avatar DavidArayan commented on July 23, 2024

Probably because UnityEngine.Plane just didn't exist or was incomplete when I worked on this code!

from ezy-slice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.