2
$\begingroup$

Please what’s the quickest way to simply flip the surface normals of a concave/convex polytope outwards e.g. I am hoping that there's a general way to get this over with using the 2-polytope (polygon) below as our scapegoat
I mean how can we make this

unflipped
become this
flipped

where $\vec{n_0}, \vec{n_1}, \vec{n_2}, \vec{n_3}, \vec{n_4}, \vec{n_5}, \vec{n_6}, \vec{n_7}, \vec{n_8}, \vec{n_9}$ are surface normals, $ABCDEFGHIJ$ the polytope (polygon) and $c$ the centroid

Contextually this problem is similar to this

$\endgroup$
1
  • 3
    $\begingroup$ Follow the polytope path in one direction and perform cross product of each segment as a vector with its normal vector. Then the question of inward/outward is equivalent to check the orientation of the cross product wrt to the polytope plane (ie check the sign of the z coordinate). $\endgroup$
    – jlandercy
    Jul 3, 2022 at 8:29

1 Answer 1

1
$\begingroup$

Label the vertices $(p_{i})_{i=0}^{n}$, so that $p_{1} = A$, $p_{2} = B$, …, $p_{n} = J = p_{0}$. The $i$th edge has direction vector $(v_{i1}, v_{i2}) = p_{i} - p_{i-1}$ for $1 \leq i \leq n$. If $n_{i} = (n_{i1}, n_{i2})$ denotes the unflipped normal vector on the $i$th edge, then the flipped normal is $$ \operatorname{sgn}(v_{i1}n_{i2} - v_{i2}n_{i1})n_{i} = \frac{v_{i1}n_{i2} - v_{i2}n_{i1}}{|v_{i1}n_{i2} - v_{i2}n_{i1}|} n_{i}. $$ The multiplier, which is $1$ if the direction-to-normal quarter-turn is counterclockwise and $-1$ if clockwise, implements jlandercy's comment

$\endgroup$
2
  • $\begingroup$ More simply, use the 2D unary cross product, $\times(v_1,v_2)=(-v_2,v_1)$, and ignore the original normal vectors. $\endgroup$
    – mr_e_man
    Jul 7, 2022 at 23:03
  • $\begingroup$ @mr_e_man Yes, though it's then necessary to normalize (unless the edges are unit-length). $\endgroup$ Jul 8, 2022 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .