Jump to content

Plane functions


macklebee
 Share

Recommended Posts

Going through the documentation and I am trying to understand how the Plane functions work: https://www.leadwerks.com/learn?page=API-Reference_Object_Math_Plane

You don't have the ability to define the plane via something like Plane:Create() so how can you perform Plane:DistanceToPoint(), Plane:GetNormal(), etc? 

And then you also have Transform:Plane() that actually has an example to try but the program fails because the transformed plane comes back as nil?

Did this work at one time and it was removed or was a work in progress that never got completed?

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

You use the plane like a Vec3.  The constructor can take three positions to define it, then you can use functions like GetNormal() and DistanceToPoint().

I imagine the positions as forming a triangle, and the plane extending out from that in all directions.

Vec3 p1 = Vec3(-1.0f, -1.0f, -1.0f);
Vec3 p2 = Vec3(0.0f, 1.0f, 1.0f);
Vec3 p3 = Vec3(1.0f, 0.0f, 0.0f);

Plane plane = Plane(p1, p2, p3);
Vec3 normal = plane.GetNormal();
float distance = plane.DistanceToPoint(2, 1, 0);

I'm not sure how to define it using the other constructors as shown in the example in Transform::Plane()

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...