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
Thepoint
could be one that you used for your vertical edge and thevector
is[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
Advertisement