Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Distance between two parallel planes
jacob_kingery
Member Posts: 39 EDU
Is there a way to find the distance between two parallel planes? Specifically, I want to determine if two planes are the 'same'; that is, there is no distance between them along the normal axis.
0
Comments
var samePlane = samePoint(plane1.origin, project(plane2, plane1.origin));<br>
We might add some more utility functions for this type of stuff...1. Constructing a vector between the plane's origins.
2. Checking if that vector is perpendicular to the plane's normal.
i.e.
arePlanesCoincident is boolean = perpendicularVectors( (plane2.origin - plane1.origin), plane1.normal ); <br>
A shorthand for this wouldn't be right to provide in std, since the computation is nonsense unless the planes are parallel. Perhaps we could have an "arePlanesCoincident" function which does both checks, and an "arePlanesParallel" function which does just the first?i.e.
distance is ValueWithUnits = worldToPlane(plane1.origin, plane2)[2];
A note on documentation - it is confusing to me that in the documentation there are two functions called "project". I understand that they do different things because they can recognize their inputs, but I think it would be much more intuitive if that were all contained within one description of the function.
That's an interesting point. Thus far, we've only been documenting overloads together in special cases: Where a parameter is optional, or where the type needn't be specified (as with
toString
).In this case, the two definitions of project seem distinct enough to warrant separate documentation, but it's definitely not ideal to the end user to have them in the different files.
Perhaps we could pull a bunch of the more commonly used functions into a file which imports all the necessary types? It'd be nice, when perusing the docs, if you could generally find things they need in a small set of files, and it would allow us to pair similar functions together to avoid this confusion (project/project, fromWorld/worldToPlane, etc.)
In your second suggestion (
distance is ValueWithUnits = worldToPlane(plane1.origin, plane2)[2];
), it appears that the point and plane parameters are switched (should beworldToPlane(plane2, plane1.origin)
). Also,worldToPlane
seems to return a vector with only 2 elements (I believe x- and y-coordinates). Do you know why there wouldn't be a z-coordinate?You could use
fromWorld(coordSystem(plane1.origin, plane1.x, plane1.normal), plane2.origin) [2];
(Though that's still untested)
There will soon be a CSys constrictor which just takes a plane, which makes that slightly easier.
A slower but simpler method is
norm(plane2.origin - project( plane1, plane2.origin ));
In the library I can actually find 3 project functions (onto a Line, Plane, or Vector) and the third one is inconsistent w.r.t. the argument order
I'll make a note to refactor that.
We may also write more for other curve and surface types.
Not sure I understand your suggestion for conveying that
project(blah, vector)
projectsvector
ontoblah
.I meant that it would be useful to note all the variations of project in the same place.