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

Function NAN_METHOD

src/Base.cc:86–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86NAN_METHOD(Base::translate)
87{
88
89 CHECK_THIS_DEFINED(Base);
90 const Base* pThis = ObjectWrap::Unwrap<Base>(info.This());
91
92 try {
93
94 gp_Trsf transformation;
95
96 double x=0,y=0,z=0;
97 if (info.Length() == 3) {
98 ReadDouble(info[0], x);
99 ReadDouble(info[1], y);
100 ReadDouble(info[2], z);
101 }
102 else if (info.Length() == 1) {
103 ReadPoint(info[0], &x, &y, &z);
104 }
105 else {
106 return Nan::ThrowError("Wrong Arguments");
107 }
108 transformation.SetTranslation(gp_Vec(x,y,z));
109
110 v8::Local<v8::Object> copy = pThis->Clone();
111
112 pThis->Unwrap(copy)->setShape(BRepBuilderAPI_Transform(pThis->shape(), transformation,Standard_True).Shape());
113
114 return info.GetReturnValue().Set(copy);
115
116 } CATCH_AND_RETHROW("Failed to calculate a translated shape ");
117
118}
119
120NAN_METHOD(Base::rotate)
121{

Callers

nothing calls this directly

Calls 8

ReadDoubleFunction · 0.85
ReadPointFunction · 0.85
ReadRotationFromArgsFunction · 0.85
ShapeMethod · 0.80
CloneMethod · 0.45
setShapeMethod · 0.45
UnwrapMethod · 0.45
fixShapeMethod · 0.45

Tested by

no test coverage detected