1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | const {addTransformationMethodsToPrototype, addCenteringToPrototype} = require('./src/core/mutators')
|
84 | let CSG = require('./src/core/CSG')
|
85 | let CAG = require('./src/core/CAG')
|
86 |
|
87 |
|
88 | const { _CSGDEBUG,
|
89 | defaultResolution2D,
|
90 | defaultResolution3D,
|
91 | EPS,
|
92 | angleEPS,
|
93 | areaEPS,
|
94 | all,
|
95 | top,
|
96 | bottom,
|
97 | left,
|
98 | right,
|
99 | front,
|
100 | back,
|
101 | staticTag,
|
102 | getTag} = require('./src/core/constants')
|
103 |
|
104 | CSG._CSGDEBUG = _CSGDEBUG
|
105 | CSG.defaultResolution2D = defaultResolution2D
|
106 | CSG.defaultResolution3D = defaultResolution3D
|
107 | CSG.EPS = EPS
|
108 | CSG.angleEPS = angleEPS
|
109 | CSG.areaEPS = areaEPS
|
110 | CSG.all = all
|
111 | CSG.top = top
|
112 | CSG.bottom = bottom
|
113 | CSG.left = left
|
114 | CSG.right = right
|
115 | CSG.front = front
|
116 | CSG.back = back
|
117 | CSG.staticTag = staticTag
|
118 | CSG.getTag = getTag
|
119 |
|
120 |
|
121 | CSG.Vector2D = require('./src/core/math/Vector2')
|
122 | CSG.Vector3D = require('./src/core/math/Vector3')
|
123 | CSG.Vertex = require('./src/core/math/Vertex3')
|
124 | CAG.Vertex = require('./src/core/math/Vertex2')
|
125 | CSG.Plane = require('./src/core/math/Plane')
|
126 | CSG.Polygon = require('./src/core/math/Polygon3')
|
127 | CSG.Polygon2D = require('./src/core/math/Polygon2')
|
128 | CSG.Line2D = require('./src/core/math/Line2')
|
129 | CSG.Line3D = require('./src/core/math/Line3')
|
130 | CSG.Path2D = require('./src/core/math/Path2')
|
131 | CSG.OrthoNormalBasis = require('./src/core/math/OrthoNormalBasis')
|
132 | CSG.Matrix4x4 = require('./src/core/math/Matrix4')
|
133 |
|
134 | CAG.Side = require('./src/core/math/Side')
|
135 |
|
136 | CSG.Connector = require('./src/core/connectors').Connector
|
137 | CSG.ConnectorList = require('./src/core/connectors').ConnectorList
|
138 | CSG.Properties = require('./src/core/Properties')
|
139 |
|
140 | const {circle, ellipse, rectangle, roundedRectangle} = require('./src/api/primitives2d')
|
141 | const {sphere, cube, roundedCube, cylinder, roundedCylinder, cylinderElliptic, polyhedron} = require('./src/api/primitives3d')
|
142 |
|
143 | CSG.sphere = sphere
|
144 | CSG.cube = cube
|
145 | CSG.roundedCube = roundedCube
|
146 | CSG.cylinder = cylinder
|
147 | CSG.roundedCylinder = roundedCylinder
|
148 | CSG.cylinderElliptic = cylinderElliptic
|
149 | CSG.polyhedron = polyhedron
|
150 |
|
151 | CAG.circle = circle
|
152 | CAG.ellipse = ellipse
|
153 | CAG.rectangle = rectangle
|
154 | CAG.roundedRectangle = roundedRectangle
|
155 |
|
156 |
|
157 | const {fromPolygons, fromCompactBinary, fromObject, fromSlices} = require('./src/core/CSGFactories')
|
158 | CSG.fromCompactBinary = fromCompactBinary
|
159 | CSG.fromObject = fromObject
|
160 | CSG.fromSlices = fromSlices
|
161 | CSG.fromPolygons = fromPolygons
|
162 |
|
163 | CSG.toPointCloud = require('./src/api/debugHelpers').toPointCloud
|
164 |
|
165 | const CAGFactories = require('./src/core/CAGFactories')
|
166 | CAG.fromSides = CAGFactories.fromSides
|
167 | CAG.fromObject = CAGFactories.fromObject
|
168 | CAG.fromPoints = CAGFactories.fromPoints
|
169 | CAG.fromPointsNoCheck = CAGFactories.fromPointsNoCheck
|
170 | CAG.fromPath2 = CAGFactories.fromPath2
|
171 | CAG.fromFakeCSG = CAGFactories.fromFakeCSG
|
172 | CAG.fromCompactBinary = CAGFactories.fromCompactBinary
|
173 |
|
174 |
|
175 |
|
176 | const optionsParsers = require('./src/api/optionParsers')
|
177 |
|
178 |
|
179 | addTransformationMethodsToPrototype(CSG.prototype)
|
180 | addTransformationMethodsToPrototype(CSG.Vector2D.prototype)
|
181 | addTransformationMethodsToPrototype(CSG.Vector3D.prototype)
|
182 | addTransformationMethodsToPrototype(CSG.Vertex.prototype)
|
183 | addTransformationMethodsToPrototype(CSG.Plane.prototype)
|
184 | addTransformationMethodsToPrototype(CSG.Polygon.prototype)
|
185 | addTransformationMethodsToPrototype(CSG.Line2D.prototype)
|
186 | addTransformationMethodsToPrototype(CSG.Line3D.prototype)
|
187 | addTransformationMethodsToPrototype(CSG.Path2D.prototype)
|
188 | addTransformationMethodsToPrototype(CSG.OrthoNormalBasis.prototype)
|
189 | addTransformationMethodsToPrototype(CSG.Connector.prototype)
|
190 |
|
191 | addTransformationMethodsToPrototype(CAG.prototype)
|
192 | addTransformationMethodsToPrototype(CAG.Side.prototype)
|
193 | addTransformationMethodsToPrototype(CAG.Vertex.prototype)
|
194 |
|
195 | addCenteringToPrototype(CSG.prototype, ['x', 'y', 'z'])
|
196 | addCenteringToPrototype(CAG.prototype, ['x', 'y'])
|
197 |
|
198 | CSG.parseOptionAs2DVector = optionsParsers.parseOptionAs3DVector
|
199 | CSG.parseOptionAs3DVector = optionsParsers.parseOptionAs3DVector
|
200 | CSG.parseOptionAs3DVectorList = optionsParsers.parseOptionAs3DVectorList
|
201 | CSG.parseOptionAsBool = optionsParsers.parseOptionAsBool
|
202 | CSG.parseOptionAsFloat = optionsParsers.parseOptionAsFloat
|
203 | CSG.parseOptionAsInt = optionsParsers.parseOptionAsInt
|
204 |
|
205 | CSG.Polygon2D.prototype = CAG.prototype
|
206 |
|
207 |
|
208 | const {isCAG, isCSG} = require('./src/core/utils')
|
209 |
|
210 | const globalApi = Object.assign({}, {CSG, CAG}, optionsParsers, {isCAG, isCSG})
|
211 |
|
212 | module.exports = globalApi
|