How to get a intersection btween a line and a face
-
there are many triangls in the bottom,but they are not in one plane, i generate a line with two points,and the line is vertical to the XYplane ,i want to get the intersection btween the line and a face.
i read the api that# This is really the normal which follows the x axis. The plane is # perpendicular plane1 = [Geom;;Point3d.new(-10, 0 ,0), Geom;;Vector3d.new(1,0,0)] # This line follows the x axis line1 = [Geom;;Point3d.new(-10,0,0), Geom;;Vector3d.new(1,0,0)] # returns -10, 0, 0 pt = Geom.intersect_line_plane(line1, plane1)but this method turn every face to be a plane,so,the intersection may be outside of the face,i want to get the intersection in the face...
would u give me some help?thank u -
You need to get the line of the edge and the plane of the face
line=edge.line plane=face.plane
Then use line/plane intersection tests etc...
http://code.google.com/apis/sketchup/docs/ourdoc/geom.html#intersect_line_plane -
ok, i got it,but there are many intersection points .the line have intersect with every face's plane,if i wanto to get the intersection point in the face,not the other faces' planes,do i have to judge with the method Face.classify_point
or other methods?
thank u ,TIG -
You could also look at
model.raytest
Thepointcould be one that you used for your vertical edge and thevectoris[0,0,-1]
It will return any arrayraytest[0]is the intersection point andraytest[1][-1]is the face or edge it hits...
http://code.google.com/apis/sketchup/docs/ourdoc/model.html#raytest
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement