#### 10.2.28 SortFacet

• SortFacet( <facets list> [, (backculling 0/1)+i*contrast ] )
• Description: a facet is a 3Dpoints list ended with the constant jump, those points should be coplanar. Example: [ Origin, M(0,1,0), M(0,0,3), jump] is a facet. The facets are oriented by the order of appearence of the vertices. That function sorts the facets from the farest to the nearest to the observer (this is the height of the center of gravity on the axis oriented towards the observer that is taken in count), and returns the resulting sorted list (the input list is not changed).

The optional argument is a complex in the form (0/1)+i*(0/1).

If the real part is $1$: the non visible facets are removed from the sort. A facet is visible if its normal unit vector (its direction is determined by the orientation of the facet) has the “same direction” as the unit vector oriented towards the obsever (the scalar product with the vector n() is positive ).

If the real part is $0$: all the facets are sorted.

If the imaginary part is $1$: to each facet a coefficient is given (the scalar product between the unit vecteur normal to the facet and Normal() that is used to nuance the fillcolor if FillStyle=full. That coefficient is stored in the imaginary part of the constant jump that is ending the facet. The graphical function Ligne reads that coefficient, that is between $0$ and $1$ for a visible facet, and multiply the rgb components of the fillcolor by that coefficient before painting.

If the imaginary part is $0$: the fillcolor won’t be nuanced.

By default, the optional argument is zero.