Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

leeminardi
en respuesta a: autoid374ceb4990

A TIN can be considered as a collection of 3DFACES.  You can determine the maximum downward slope (the direction a drop of water will travel) as follows:

  1. Give  a 3DFace with vertices A, B, and C and a point P on the face determine the normal vector to the face:
    nrm = (B-A) cross (C-A)
  2. Check that the normal has a positive Z component:
    if ( nrm dot [0,0,1] < 0 then multiply the nrm by -1.
  3. Take the cross product of the normal and the z direction
    v = nrm cross [0,0,1]
  4. Take the cross product of the normal and v
    w = nrm cross v
    w is the vector pointing in the direction of the water drop travel.
  5. Find the point Q on the edge of the face where the drop leaves by looking at the three intersection points of a line going from p in the direction w. Note, two of the intersection points wil be on the finite line segment AB, BC or CA.  Disregard the intersection point that is not on the line segment and choose the intersection point with the lowest z coordinate of the other two. 
    Q1 = intersection of line p (p + w) and A B
    Q2 = intersection of line p (p + w) and B C
    Q3 = intersection of line p (p + w) and C A
  6. A line from P to Q is the path of the water drop
  7. Use Q one the adjacent face as the P for the next face and repeat!

 

lee.minardi