Open petersesztak opened 3 years ago
Another attempt:
g3.Vector3d origin = new g3.Vector3d(0, 0, 50); g3.Vector3d direction = new g3.Vector3d(t_point_a, t_point_b, t_point_L); g3.Ray3d ray = new g3.Ray3d(origin, direction);
g3.Triangle3d triangle3D = new g3.Triangle3d(V0, V1, V2); g3.IntrRay3Triangle3 intrRay3Triangle3 = new g3.IntrRay3Triangle3(ray, triangle3D); intrRay3Triangle3.Compute(); var intersectionResult = intrRay3Triangle3.Result; // Intersects : OK, as expected // How to get the intersection point coordinates ?
You can use the TriangleBaryCoords member. This is the barycentric coordinates of the intersection point in the triangle. So the intersection point is BaryCoords.XV0 + BaryCoords.YV1 + BaryCoords.Z*V2, or use Triangle3d.PointAt() which takes the barycentric coordinates.
(more details: https://en.wikipedia.org/wiki/Barycentric_coordinate_system#Barycentric_coordinates_on_triangles )
Dear Ryan, Great thanks ! : works like a charm :) Br, Péter
First of all: thanks for sharing your powerfull library !
I have a very easy tasks -but can't figure out how to do that with geometry3Sharp? :
In 3D space: how to find Ray3 and Triangle3 intersection point coordinates (e.g. Xhit, Yhit, Zhit)? All what I can do to find out : bool IsIntersected and distance, but I need intersection point coordinates as well:
This is where I'm actually:
g3.Vector3d origin = new g3.Vector3d(0, 0, 50); g3.Vector3d direction = new g3.Vector3d(t_point_X, t_point_Y, t_point_Z); g3.Ray3d ray = new g3.Ray3d(origin, direction);
So, ho to find intersection point coordinates ?
Thanks for your kind help in advance, Best Regards, Peter