PVS: V522 There might be dereferencing of a potential null pointer 'Py::Vector2d().getCxxObject()'
This commit is contained in:
@@ -78,6 +78,16 @@ namespace Py {
|
||||
|
||||
typedef PythonClassObject<Base::Vector2dPy> Vector2d;
|
||||
|
||||
inline Base::Vector2d toVector2d(PyObject *py) {
|
||||
Base::Vector2dPy* py2d = Py::Vector2d(py).getCxxObject();
|
||||
return py2d ? py2d->value() : Base::Vector2d();
|
||||
}
|
||||
|
||||
inline Base::Vector2d toVector2d(const Object& py) {
|
||||
Base::Vector2dPy* py2d = Py::Vector2d(py).getCxxObject();
|
||||
return py2d ? py2d->value() : Base::Vector2d();
|
||||
}
|
||||
|
||||
// Implementing the vector class in the fashion of the PyCXX library.
|
||||
class BaseExport Vector : public Object
|
||||
{
|
||||
|
||||
@@ -88,9 +88,9 @@ int ArcOfCircle2dPy::PyInit(PyObject* args, PyObject* /*kwds*/)
|
||||
if (PyArg_ParseTuple(args, "O!O!O!", Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2,
|
||||
Base::Vector2dPy::type_object(), &pV3)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v3 = Py::Vector2d(pV3).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
Base::Vector2d v3 = Py::toVector2d(pV3);
|
||||
|
||||
GCE2d_MakeArcOfCircle arc(gp_Pnt2d(v1.x,v1.y),
|
||||
gp_Pnt2d(v2.x,v2.y),
|
||||
|
||||
@@ -70,7 +70,7 @@ Py::Object ArcOfConic2dPy::getLocation(void) const
|
||||
|
||||
void ArcOfConic2dPy::setLocation(Py::Object arg)
|
||||
{
|
||||
Base::Vector2d loc = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d loc = Py::toVector2d(arg.ptr());
|
||||
getGeom2dArcOfConicPtr()->setLocation(loc);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void ArcOfConic2dPy::setXAxis(Py::Object arg)
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
|
||||
Base::Vector2d dir = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d dir = Py::toVector2d(arg.ptr());
|
||||
gp_Ax2d xaxis = conic->XAxis();
|
||||
xaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
|
||||
conic->SetXAxis(xaxis);
|
||||
@@ -121,7 +121,7 @@ void ArcOfConic2dPy::setYAxis(Py::Object arg)
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(getGeom2dArcOfConicPtr()->handle());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(curve->BasisCurve());
|
||||
Base::Vector2d dir = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d dir = Py::toVector2d(arg.ptr());
|
||||
gp_Ax2d yaxis = conic->YAxis();
|
||||
yaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
|
||||
conic->SetYAxis(yaxis);
|
||||
|
||||
@@ -361,7 +361,7 @@ PyObject* BSplineCurve2dPy::setPole(PyObject * args)
|
||||
PyObject* p;
|
||||
if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight))
|
||||
return 0;
|
||||
Base::Vector2d vec = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(p);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
try {
|
||||
Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast
|
||||
@@ -554,7 +554,7 @@ PyObject* BSplineCurve2dPy::movePoint(PyObject * args)
|
||||
if (!PyArg_ParseTuple(args, "dO!ii", &U, Base::Vector2dPy::type_object(),&pnt, &index1, &index2))
|
||||
return 0;
|
||||
try {
|
||||
Base::Vector2d p = Py::Vector2d(pnt).getCxxObject()->value();
|
||||
Base::Vector2d p = Py::toVector2d(pnt);
|
||||
Handle(Geom2d_BSplineCurve) curve = Handle(Geom2d_BSplineCurve)::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
int first, last;
|
||||
@@ -819,7 +819,7 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds)
|
||||
TColgp_Array1OfPnt2d pnts(1,list.size());
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d vec = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(*it);
|
||||
pnts(index++) = gp_Pnt2d(vec.x,vec.y);
|
||||
}
|
||||
|
||||
@@ -924,7 +924,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject *
|
||||
std::vector<gp_Pnt2d> interpPoints;
|
||||
interpPoints.reserve(list.size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pnt = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(*it);
|
||||
interpPoints.push_back(gp_Pnt2d(pnt.x,pnt.y));
|
||||
}
|
||||
|
||||
@@ -951,7 +951,7 @@ PyObject* BSplineCurve2dPy::getCardinalSplineTangents(PyObject *args, PyObject *
|
||||
std::vector<gp_Pnt2d> interpPoints;
|
||||
interpPoints.reserve(list.size());
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pnt = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(*it);
|
||||
interpPoints.push_back(gp_Pnt2d(pnt.x,pnt.y));
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
Handle(TColgp_HArray1OfPnt2d) interpolationPoints = new TColgp_HArray1OfPnt2d(1, list.size());
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pnt = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(*it);
|
||||
interpolationPoints->SetValue(index++, gp_Pnt2d(pnt.x,pnt.y));
|
||||
}
|
||||
|
||||
@@ -1036,8 +1036,8 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
|
||||
if (t1 && t2) {
|
||||
Base::Vector2d v1 = Py::Vector2d(t1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(t2).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(t1);
|
||||
Base::Vector2d v2 = Py::toVector2d(t2);
|
||||
gp_Vec2d initTangent(v1.x,v1.y), finalTangent(v2.x,v2.y);
|
||||
aBSplineInterpolation->Load(initTangent, finalTangent);
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds)
|
||||
TColgp_Array1OfVec2d tangents(1, tlist.size());
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = tlist.begin(); it != tlist.end(); ++it) {
|
||||
Base::Vector2d vec = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(*it);
|
||||
tangents.SetValue(index++, gp_Vec2d(vec.x,vec.y));
|
||||
}
|
||||
|
||||
@@ -1094,7 +1094,7 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args)
|
||||
TColgp_Array1OfPnt2d poles(1, list.size());
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pnt = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(*it);
|
||||
poles(index++) = gp_Pnt2d(pnt.x,pnt.y);
|
||||
}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
||||
TColgp_Array1OfPnt2d occpoles(1, number_of_poles);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pnt = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(*it);
|
||||
occpoles(index++) = gp_Pnt2d(pnt.x,pnt.y);
|
||||
}
|
||||
//Calculate the number of knots
|
||||
|
||||
@@ -104,7 +104,7 @@ PyObject* BezierCurve2dPy::insertPoleAfter(PyObject * args)
|
||||
PyObject* p;
|
||||
if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight))
|
||||
return 0;
|
||||
Base::Vector2d vec = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(p);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
try {
|
||||
Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast
|
||||
@@ -126,7 +126,7 @@ PyObject* BezierCurve2dPy::insertPoleBefore(PyObject * args)
|
||||
PyObject* p;
|
||||
if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight))
|
||||
return 0;
|
||||
Base::Vector2d vec = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(p);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
try {
|
||||
Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast
|
||||
@@ -184,7 +184,7 @@ PyObject* BezierCurve2dPy::setPole(PyObject * args)
|
||||
PyObject* p;
|
||||
if (!PyArg_ParseTuple(args, "iO!|d", &index, Base::Vector2dPy::type_object(), &p, &weight))
|
||||
return 0;
|
||||
Base::Vector2d vec = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(p);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
try {
|
||||
Handle(Geom2d_BezierCurve) curve = Handle(Geom2d_BezierCurve)::DownCast
|
||||
@@ -268,7 +268,7 @@ PyObject* BezierCurve2dPy::setPoles(PyObject * args)
|
||||
TColgp_Array1OfPnt2d poles(1,list.size());
|
||||
int index = poles.Lower();
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
Base::Vector2d pole = Py::Vector2d(*it).getCxxObject()->value();
|
||||
Base::Vector2d pole = Py::toVector2d(*it);
|
||||
poles.SetValue(index++, gp_Pnt2d(pole.x,pole.y));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!d", keywords_cnr,
|
||||
Base::Vector2dPy::type_object(), &pV1,
|
||||
&dist)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
GCE2d_MakeCircle mc(gp_Pnt2d(v1.x,v1.y), dist);
|
||||
if (!mc.IsDone()) {
|
||||
PyErr_SetString(PartExceptionOCCError, gce_ErrorStatusText(mc.Status()));
|
||||
@@ -109,9 +109,9 @@ int Circle2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2,
|
||||
Base::Vector2dPy::type_object(), &pV3)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v3 = Py::Vector2d(pV3).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
Base::Vector2d v3 = Py::toVector2d(pV3);
|
||||
GCE2d_MakeCircle mc(gp_Pnt2d(v1.x,v1.y),
|
||||
gp_Pnt2d(v2.x,v2.y),
|
||||
gp_Pnt2d(v3.x,v3.y));
|
||||
|
||||
@@ -68,7 +68,7 @@ Py::Object Conic2dPy::getLocation(void) const
|
||||
|
||||
void Conic2dPy::setLocation(Py::Object arg)
|
||||
{
|
||||
Base::Vector2d loc = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d loc = Py::toVector2d(arg.ptr());
|
||||
getGeom2dConicPtr()->setLocation(loc);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ Py::Object Conic2dPy::getXAxis(void) const
|
||||
|
||||
void Conic2dPy::setXAxis(Py::Object arg)
|
||||
{
|
||||
Base::Vector2d dir = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d dir = Py::toVector2d(arg.ptr());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(getGeom2dConicPtr()->handle());
|
||||
gp_Ax2d xaxis = conic->XAxis();
|
||||
xaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
|
||||
@@ -113,7 +113,7 @@ Py::Object Conic2dPy::getYAxis(void) const
|
||||
|
||||
void Conic2dPy::setYAxis(Py::Object arg)
|
||||
{
|
||||
Base::Vector2d dir = Py::Vector2d(arg.ptr()).getCxxObject()->value();
|
||||
Base::Vector2d dir = Py::toVector2d(arg.ptr());
|
||||
Handle(Geom2d_Conic) conic = Handle(Geom2d_Conic)::DownCast(getGeom2dConicPtr()->handle());
|
||||
gp_Ax2d yaxis = conic->YAxis();
|
||||
yaxis.SetDirection(gp_Dir2d(dir.x, dir.y));
|
||||
|
||||
@@ -708,7 +708,7 @@ PyObject* Curve2dPy::parameter(PyObject *args)
|
||||
PyObject *p;
|
||||
if (!PyArg_ParseTuple(args, "O!", Base::Vector2dPy::type_object(), &p))
|
||||
return 0;
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
gp_Pnt2d pnt(v.x,v.y);
|
||||
Geom2dAPI_ProjectPointOnCurve ppc(pnt, c);
|
||||
double val = ppc.LowerDistanceParameter();
|
||||
|
||||
@@ -82,9 +82,9 @@ int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2,
|
||||
Base::Vector2dPy::type_object(), &pV3)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v3 = Py::Vector2d(pV3).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
Base::Vector2d v3 = Py::toVector2d(pV3);
|
||||
GCE2d_MakeEllipse me(gp_Pnt2d(v1.x,v1.y),
|
||||
gp_Pnt2d(v2.x,v2.y),
|
||||
gp_Pnt2d(v3.x,v3.y));
|
||||
@@ -105,7 +105,7 @@ int Ellipse2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!dd", keywords_cmm,
|
||||
Base::Vector2dPy::type_object(), &pV,
|
||||
&major, &minor)) {
|
||||
Base::Vector2d c = Py::Vector2d(pV).getCxxObject()->value();
|
||||
Base::Vector2d c = Py::toVector2d(pV);
|
||||
GCE2d_MakeEllipse me(gp_Ax2d(gp_Pnt2d(c.x,c.y), gp_Dir2d(0.0,1.0)),
|
||||
major, minor);
|
||||
if (!me.IsDone()) {
|
||||
|
||||
@@ -76,7 +76,7 @@ PyObject* Geometry2dPy::mirror(PyObject *args)
|
||||
{
|
||||
PyObject* o;
|
||||
if (PyArg_ParseTuple(args, "O!", Base::Vector2dPy::type_object(),&o)) {
|
||||
Base::Vector2d vec = Py::Vector2d(o).getCxxObject()->value();
|
||||
Base::Vector2d vec = Py::toVector2d(o);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
getGeometry2dPtr()->handle()->Mirror(pnt);
|
||||
Py_Return;
|
||||
@@ -86,8 +86,8 @@ PyObject* Geometry2dPy::mirror(PyObject *args)
|
||||
PyObject* axis;
|
||||
if (PyArg_ParseTuple(args, "O!O!", Base::Vector2dPy::type_object(),&o,
|
||||
Base::Vector2dPy::type_object(),&axis)) {
|
||||
Base::Vector2d pnt = Py::Vector2d(o).getCxxObject()->value();
|
||||
Base::Vector2d dir = Py::Vector2d(axis).getCxxObject()->value();
|
||||
Base::Vector2d pnt = Py::toVector2d(o);
|
||||
Base::Vector2d dir = Py::toVector2d(axis);
|
||||
gp_Ax2d ax1(gp_Pnt2d(pnt.x,pnt.y), gp_Dir2d(dir.x,dir.y));
|
||||
getGeometry2dPtr()->handle()->Mirror(ax1);
|
||||
Py_Return;
|
||||
@@ -103,7 +103,7 @@ PyObject* Geometry2dPy::rotate(PyObject *args)
|
||||
double angle;
|
||||
Base::Vector2d vec;
|
||||
if (PyArg_ParseTuple(args, "O!d", Base::Vector2dPy::type_object(), &o, &angle)) {
|
||||
vec = Py::Vector2d(o).getCxxObject()->value();
|
||||
vec = Py::toVector2d(o);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
getGeometry2dPtr()->handle()->Rotate(pnt, angle);
|
||||
Py_Return;
|
||||
@@ -119,7 +119,7 @@ PyObject* Geometry2dPy::scale(PyObject *args)
|
||||
double scale;
|
||||
Base::Vector2d vec;
|
||||
if (PyArg_ParseTuple(args, "O!d", Base::Vector2dPy::type_object(), &o, &scale)) {
|
||||
vec = Py::Vector2d(o).getCxxObject()->value();
|
||||
vec = Py::toVector2d(o);
|
||||
gp_Pnt2d pnt(vec.x, vec.y);
|
||||
getGeometry2dPtr()->handle()->Scale(pnt, scale);
|
||||
Py_Return;
|
||||
@@ -161,7 +161,7 @@ PyObject* Geometry2dPy::translate(PyObject *args)
|
||||
PyObject* o;
|
||||
Base::Vector2d vec;
|
||||
if (PyArg_ParseTuple(args, "O!", Base::Vector2dPy::type_object(),&o)) {
|
||||
vec = Py::Vector2d(o).getCxxObject()->value();
|
||||
vec = Py::toVector2d(o);
|
||||
gp_Vec2d trl(vec.x, vec.y);
|
||||
getGeometry2dPtr()->handle()->Translate(trl);
|
||||
Py_Return;
|
||||
|
||||
@@ -82,9 +82,9 @@ int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2,
|
||||
Base::Vector2dPy::type_object(), &pV3)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v3 = Py::Vector2d(pV3).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
Base::Vector2d v3 = Py::toVector2d(pV3);
|
||||
GCE2d_MakeHyperbola me(gp_Pnt2d(v1.x,v1.y),
|
||||
gp_Pnt2d(v2.x,v2.y),
|
||||
gp_Pnt2d(v3.x,v3.y));
|
||||
@@ -105,7 +105,7 @@ int Hyperbola2dPy::PyInit(PyObject* args, PyObject* kwds)
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "O!dd", keywords_cmm,
|
||||
Base::Vector2dPy::type_object(), &pV,
|
||||
&major, &minor)) {
|
||||
Base::Vector2d c = Py::Vector2d(pV).getCxxObject()->value();;
|
||||
Base::Vector2d c = Py::toVector2d(pV);
|
||||
GCE2d_MakeHyperbola me(gp_Ax2d(gp_Pnt2d(c.x,c.y), gp_Dir2d(0.0,1.0)),
|
||||
major, minor);
|
||||
if (!me.IsDone()) {
|
||||
|
||||
@@ -82,8 +82,8 @@ int Line2dPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyObject *pV1, *pV2;
|
||||
if (PyArg_ParseTuple(args, "O!O!", Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
try {
|
||||
// Create line out of two points
|
||||
double distance = (v1-v2).Length();
|
||||
@@ -145,7 +145,7 @@ void Line2dPy::setLocation(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
pnt.SetX(v.x);
|
||||
pnt.SetY(v.y);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void Line2dPy::setDirection(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
dir = gp_Dir2d(v.x,v.y);
|
||||
}
|
||||
else if (PyTuple_Check(p)) {
|
||||
|
||||
@@ -131,8 +131,8 @@ int Line2dSegmentPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyObject *pV1, *pV2;
|
||||
if (PyArg_ParseTuple(args, "O!O!", Base::Vector2dPy::type_object(), &pV1,
|
||||
Base::Vector2dPy::type_object(), &pV2)) {
|
||||
Base::Vector2d v1 = Py::Vector2d(pV1).getCxxObject()->value();
|
||||
Base::Vector2d v2 = Py::Vector2d(pV2).getCxxObject()->value();
|
||||
Base::Vector2d v1 = Py::toVector2d(pV1);
|
||||
Base::Vector2d v2 = Py::toVector2d(pV2);
|
||||
try {
|
||||
// Create line out of two points
|
||||
double distance = (v1-v2).Length();
|
||||
@@ -219,7 +219,7 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
p1.SetX(v.x);
|
||||
p1.SetY(v.y);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg)
|
||||
|
||||
PyObject *p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, Base::Vector2dPy::type_object())) {
|
||||
Base::Vector2d v = Py::Vector2d(p).getCxxObject()->value();
|
||||
Base::Vector2d v = Py::toVector2d(p);
|
||||
p2.SetX(v.x);
|
||||
p2.SetY(v.y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user