How to get face area and how to iterate vertices of a face in counterclockwise

Dear Openflipper, We have two questions. Hopefully we can get answers from you. 1). We can not use the following formula to get the right face area . 0.5* (((p1-p0) * (p2-p0)).norm()); For instance, the right value should be 0.145643363, but we got 0.0874207. x y z 0.2649 0.1398 4.8136 0.7567 0.0491 4.8185 0.6181 -0.0791 4.2549 i j k 0.4918 -0.0907 0.0049 0.3532 -0.2189 -0.5587 0.0517467 0.27649934 -0.07562 0.002677721 0.076451885 0.005718 0.084848 0.145643 2). How to iterate vertices of a face in counterclockwise? Thank you very much! Best Regards, Xianyong Liu.

Hi, On 25.10.2012 18:01, 刘先勇 wrote:
Dear Openflipper,
We have two questions. Hopefully we can get answers from you.
1). We can not use the following formula to get the right face area . 0.5* (((p1-p0) * (p2-p0)).norm()); For instance, the right value should be 0.145643363, but we got 0.0874207.
x y z 0.2649 0.1398 4.8136 0.7567 0.0491 4.8185 0.6181 -0.0791 4.2549
i j k 0.4918 -0.0907 0.0049 0.3532 -0.2189 -0.5587
0.0517467 0.27649934 -0.07562 0.002677721 0.076451885 0.005718 0.084848 0.145643
The area is defined via the cross product, but you use the scalar product. Changing your function to 0.5* (((p1-p0) % (p2-p0)).norm()); will fix it.
2). How to iterate vertices of a face in counterclockwise?
There is no fixed function for this, but you can simply walk around your vertex on your own: Take one outgoing halfedge ohe; To go counterclockwise to the next halfedge do: he = mesh.prev_halfedge_handle(he); he = opposite_halfedge_handle(he); To get the vertices, Just use mesh.to_vertex_handle(he); Best, Jan Möbius -- Dipl.Inform. Jan Möbius Department of Computer Science VIII Aachen University of Technology (RWTH) Ahornstrasse 55, 52074 Aachen, Germany Phone ++49 (0)241 80-21817 Fax ++49 (0)241 80-22899 mailto:moebius@cs.rwth-aachen.de http://www.rwth-graphics.de
participants (2)
-
Jan Möbius
-
刘先勇