dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23

Thread: Triange Side Lengts to anles

  1. #21
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    That is great and very helpful.

    What I did to get the axis perpendicular to two vectors is through solving two equations.

    a1*x+b1*y+c1*z=0;
    a2*x+b2*y+c2*z=0;

    I assume z=1 and get y = (c1*a2-c2*a1)/(a1*b2-a2*b1); x = (c1*b2-c2*b1)/(b1*a2-b2*a1); and then handle the condition that z=0; That is awkward.

    Now I get it and the calculation will be straght forward. I am glad I learn much from this thread.

    One thing puzzles me.

    The surface normal is calculated from vectorA and vectorB. If we swap vectorA and vectorB, the plane is the same, but the calculated surface normal will be a "negative" of the formal one.

    I use that axis to rotate an angle so that vectorA may conform with vectorB. But I dont know whether I should rotate it Clockwise or counter-clockwise. (or which surface normal I should pick, the first one or the second one ?)

  2. #22
    Senior Member
    Join Date
    Nov 2003
    Posts
    524
    Hi Ericlin,
    A lot of 3D engines have the vertices of faces/polygons in a counter-clockwise order. So thats what I usually use. So the dot-product will return a positive. Having a positive figure is often convienient for lighting and calculating specular reflection ... makes the code cleaner, but I don't think there is any real concrete convention.

    I am not really sure what you are rotating? But at a guess I would say counter-clockwise because an inverse of a Mesh Rotation Matrix is usualy used to place a First Person Camera into Mesh Space.

    Shipstern

  3. #23
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    Thank you.

    So, the standard way to "Get two directional vectors from the points on the plane.", is to pick B then C point in counter-clockwise order.

    If we just pick B and C randomly, the order might be clockwise and the calculated surface normal might just point in opposite direction. And, the dot_product might be <0 rather than >0.

    OK, instead of keeping asking questions here, I 'd better read some books now. Thank you, thank you , thank you.

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

HTML5 Development Center