MCPcopy Create free account
hub / github.com/OpenWebCAD/node-occ / ReadAx2

Function ReadAx2

src/ShapeFactory.cc:261–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void ReadAx2(const v8::Local<v8::Value>& value, gp_Ax2* ax2)
262{
263 assert(ax2);
264 if (value->IsArray()) {
265 v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(value);
266 gp_Pnt origin;
267
268 auto element0 = Nan::Get(arr,0).ToLocalChecked();
269
270 ReadPoint(element0, &origin);
271 if (arr->Length() == 2) {
272 // variation 2 : gp_Ax2(const gp_Pnt& P,const gp_Dir& V);
273 gp_Dir V;
274 auto element1 = Nan::Get(arr,1).ToLocalChecked();
275 ReadDir(element1, &V);
276 *ax2 = gp_Ax2(origin, V);
277 }
278 if (arr->Length() == 3) {
279 // variation 1 : gp_Ax2(const gp_Pnt& P,const gp_Dir& N,const gp_Dir& Vx);
280 gp_Dir N, Vx;
281 auto element1 = Nan::Get(arr,1).ToLocalChecked();
282 auto element2 = Nan::Get(arr,2).ToLocalChecked();
283 ReadDir(element1, &N);
284 ReadDir(element2, &Vx);
285 *ax2 = gp_Ax2(origin, N, Vx);
286 }
287 }
288 else {
289 Nan::ThrowError("Cannot extract Axis from arrgument value");
290 }
291}
292
293NAN_METHOD(ShapeFactory::makeCylinder)
294{

Callers 1

NAN_METHODFunction · 0.85

Calls 2

ReadPointFunction · 0.85
ReadDirFunction · 0.85

Tested by

no test coverage detected