1 | <?php |
||
17 | class STLFacetNormal |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $coordinatesArray; |
||
23 | |||
24 | /** |
||
25 | * @var STLVertex |
||
26 | */ |
||
27 | private $vertex; |
||
28 | |||
29 | /** |
||
30 | * @return STLVertex |
||
31 | */ |
||
32 | public function getVertex(): STLVertex |
||
36 | |||
37 | /** |
||
38 | * @param STLVertex $vertex |
||
39 | * @return STLFacetNormal |
||
40 | */ |
||
41 | public function setVertex(STLVertex $vertex): STLFacetNormal |
||
46 | |||
47 | /** |
||
48 | * @return array |
||
49 | */ |
||
50 | public function getCoordinatesArray(): array |
||
54 | |||
55 | /** |
||
56 | * @param array $coordinatesArray |
||
57 | * @return STLFacetNormal |
||
58 | */ |
||
59 | public function setCoordinatesArray(array $coordinatesArray): STLFacetNormal |
||
64 | |||
65 | // Class should never be instantiated directly, as it emulates constructor overloading. |
||
66 | private function __construct() |
||
69 | |||
70 | /** |
||
71 | * Class constructor from an STL facet normal string. |
||
72 | * |
||
73 | * Example facet normal string: |
||
74 | * |
||
75 | * facet normal 0.5651193 -0.07131607 0.8219211 |
||
76 | * outerloop |
||
77 | * vertex -71.74323 47.70205 4.666243 |
||
78 | * vertex -72.13071 47.70205 4.932664 |
||
79 | * vertex -72.1506 47.2273 4.905148 |
||
80 | * endloop |
||
81 | * endfacet |
||
82 | * |
||
83 | * @param string $stlFacetNormalString |
||
84 | * @return STLFacetNormal |
||
85 | */ |
||
86 | public static function fromString(string $stlFacetNormalString) : STLFacetNormal |
||
103 | |||
104 | /** |
||
105 | * Class constructor from an STL facet normal array. |
||
106 | * |
||
107 | * Example facet normal array: |
||
108 | * array( |
||
109 | * "coordinates" => array(0.5651193, -0.07131607, 0.8219211), |
||
110 | * "vertex" => array( |
||
111 | * array( |
||
112 | * -71.74323, 47.70205, 4.666243 |
||
113 | * ), |
||
114 | * array( |
||
115 | * -72.13071, 47.70205, 4.932664 |
||
116 | * ), |
||
117 | * array( |
||
118 | * -72.1506, 47.2273, 4.905148 |
||
119 | * ) |
||
120 | * ) |
||
121 | * ) |
||
122 | * |
||
123 | * @param array $stlFacetNormalArray |
||
124 | * @return STLFacetNormal |
||
125 | */ |
||
126 | public static function fromArray(array $stlFacetNormalArray) : STLFacetNormal |
||
133 | |||
134 | /** |
||
135 | * Returns facet normal as array. |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | public function toArray() : array |
||
146 | |||
147 | /** |
||
148 | * Returns facet as string. |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function toString() : string |
||
159 | } |