Hello!
To get the Hessian representation of a Plane geometry, I go through these stages:
- Sample a random point on the surface (around 10 lines of code)
- Get the world normals of the mesh (around 4 lines of code)
- Calculate the normal.x, normal.y, normal.z and the constant p for the Plane constructor (around 10 lines of code)
So it takes around 24 lines of code to get the Plane object from a Plane mesh. I believe it would be really useful to have a one-liner (Plane.fromPlaneGeometry() or something like that) since the Plane class can be really handy when estimating collisions etc.
Thanks!
Avoid calling
new
orclone()
in hot methods.To get you started, here is a first-cut at a method to do what you want. It is sightly more complicated if the mesh has a parent object.