Results 1 to 5 of 5

Thread: Planes, Trains, and Triangles

  1. #1
    Zaei
    Guest

    Planes, Trains, and Triangles

    Little bit of subject line humor there =).

    Ok, here I go with my question. I have a lot of 3d points, which i can form into a plane. I can also find out where a ray intersects the plane. What i want to do is feed a function with 3 points at a time (a triangle), and know if the point of intersection on the plane is within that triangle.
    Code:
    ::strikes with bad ASCII art::
                                       / <-Ray
    ---------------------------------/----     
    \                              /       \ 
      \                          /           \  <-Plane
        \                      /               \
          \             +---+/                   \
            \            \ /*\                     \
              \           +---+ <-Square             \
                \                                      \
                 ----------------------------------------
    *= instersect point.
    Hope that makes sense... If anyone can help me out, I would be grateful =).

    Z.

    [edit]
    instersect point? i cannot spell =).

  2. #2
    Lively Member
    Join Date
    May 2000
    Posts
    84
    If you can find the point in the plane that the ray intersects in your should be able to find a square made up of four adjcent points that it passes through.

    assuming all of you triangles that make up the plane are aligned the same way

    Code:
    P1 -------
       \     /\
        \   /  \
         \ /    \
          ------- P2
    Two of you triangle vertices will always be the same, the ones that determine the diagonal. Then to find the third vetice you find which of the points P1 or P2 is closer to the intersection point.
    Last edited by Illuminator; May 25th, 2001 at 05:48 PM.

  3. #3
    Zaei
    Guest
    What is a formula to determine if a point is within a triangle? Doesnt matter if its 2D or 3D, either will work.

    Z.

  4. #4
    Zaei
    Guest
    Woo hoo. I figured this one out =). If anyone ever needs this for anything, to find if a point lies within a triangle on a plane, first make vectors running from the point you want to test to each point in the triangle, then you add the angles between each vector (DotProduct). If the total equals (is within say, 0.01 of) 2Pi, the point is withing the triangle.

    Z.

  5. #5
    New Member
    Join Date
    Oct 2005
    Posts
    3

    Re: Planes, Trains, and Triangles

    This solution is simple enough for me. You may try it.
    If the triangle is A B C and the point is P, check if the area of triangle ABC is equal (difference 0.00001) same as sum of areas of triangles made by either side of triangle and point P

    area(ABC) - [area(ABP)+area(ACP)+area(BCP)] < 0.00001

    You may calculate area of triangle using Heron Formula:
    http://mathworld.wolfram.com/HeronsFormula.html

    I need a VB code to determine intersection point of line and a plane (triangle). Does anyone have it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width