mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-26 00:40:49 +05:00
Add method for getting tangent on curve by parameter
This commit is contained in:
parent
5eaa0b7f1e
commit
f5b9e11841
@ -221,6 +221,55 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
|
|||||||
return aPoint;
|
return aPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeTangentOnCurve
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve
|
||||||
|
(const Handle(GEOM_Object)& theCurve, double theParameter)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theCurve.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Add a new Vector object
|
||||||
|
Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR);
|
||||||
|
|
||||||
|
//Add a new Point function for creation a point relativley another point
|
||||||
|
Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR);
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_IVector aVI (aFunction);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aRefFunction = theCurve->GetLastFunction();
|
||||||
|
if (aRefFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
aVI.SetCurve(aRefFunction);
|
||||||
|
aVI.SetParameter(theParameter);
|
||||||
|
|
||||||
|
//Compute the vector value
|
||||||
|
try {
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Vector driver failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump(aFunction) << aVec << " = geompy.MakeTangentOnCurve("
|
||||||
|
<< theCurve << ", " << theParameter << ")";
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return aVec;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
|
@ -47,6 +47,9 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
|
|||||||
Standard_EXPORT Handle(GEOM_Object) MakeVectorTwoPnt (Handle(GEOM_Object) thePnt1,
|
Standard_EXPORT Handle(GEOM_Object) MakeVectorTwoPnt (Handle(GEOM_Object) thePnt1,
|
||||||
Handle(GEOM_Object) thePnt2);
|
Handle(GEOM_Object) thePnt2);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) MakeTangentOnCurve(const Handle(GEOM_Object)& theCurve,
|
||||||
|
double theParameter);
|
||||||
|
|
||||||
// Line
|
// Line
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1,
|
Standard_EXPORT Handle(GEOM_Object) MakeLineTwoPnt (Handle(GEOM_Object) thePnt1,
|
||||||
Handle(GEOM_Object) thePnt2);
|
Handle(GEOM_Object) thePnt2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user