# Get plane from 3D model in Processing

i have define 3d model and a plane in PShape. I want to get a plane with modification as shown in above image.

2 Likes

hello and welcome to the forum!

Great to have you here!

Do you need mathematical formula of cross-section between the plane and PShape or is it enough that cross-section is visible in different colour like in the image? Latter should be doable with suitably selected colours (with alpha transparency), blendMode and just drawing those elements.

Getting a formula of cross-section might envolve a bit tricky mathematics.

2 Likes
1. how to apply any operation between plane and PShape ?
2. can we convert PShape and plane to array and then apply any operation? and how to convert to array?
3. any other way ?
1 Like

What do you exactly want? Draw the cross-section (you don’t have to calculate anything, color blending and 3D engine in the background will do the work)? Or find a formula or list of coordinates that form the cross-section? I don’t think there is easy way around there. You would need to go through all elements in PShape and check if they have any common points with the plain. Maybe linear algebra has an easier solution, but that’s beyond my understanding of maths.

2 Likes

Exactly i need to calculate circumferences of cross-section area.
In my case most of cross-section is circle or eclipse so i think like if i get diameter or both axis length then using formula i can calculate circumferences. i think like if i get cross-section area with different color in the plane then i calculate that diameter.
How to go through all elements in PShape and check if they have any common points with the plane ?
If you have any other idea then suggest me.

I thought it would work so that you go through all elements in PShape and check if it has an intersecting point(s) with the plane. But and I think this is a big but. Elements of PShape are not in same coordinates as the plane. So you would need to change coordinates of each element. And even then you would only get some of the points that form the intersection between the object and the plane.

This is mostly guesswork, since I haven’t worked with 3D PShapes

2 Likes

I believe that finding a planar cross section from a model will be extremely hard to do with PShape. Really, really hard, to the point that this is probably not the right tool for the job.

@quark might have some ideas about whether or not finding a planar cross section would be easier with the Shapes3D library – but I suspect not.

If your model mesh had points at regular height intervals and you were just checking for points lying on one of those planes then I could imagine it might be more doable – but that is a pretty restricted case, and most models don’t / won’t look like that, unless you are the one creating the models and you can enforce that kind of constraint.

The Shapes3D library won’t help here.

How to get all information of vertex, it’s normal which are inside .OBJ file in Java or Python mode in array format?

It depends on how you create your PShape, vertex data is then stored in different ways. This is one of the frustrating things about PShape.

If it is a simple file then you can use getVertexCount() and getVertex()

https://processing.org/reference/PShape.html