sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    How to get a intersection btween a line and a face

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 201 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Mcdull
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          Mcdull
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            You could also look at model.raytest
            The point could be one that you used for your vertical edge and the vector is [0,0,-1]
            It will return any array raytest[0] is the intersection point and raytest[1][-1] is the face or edge it hits...
            http://code.google.com/apis/sketchup/docs/ourdoc/model.html#raytest

            TIG

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement