Wed, 04/17/2024 - 15:25
Hello everyone, I first create an approximation curve through a set of points, and then display it in AIS. When I select the generated curve with my mouse and get parameters like NbPoles () for the curve, there is a huge change. ; for example, oricurve has a value of 4, but the NBPOLES () of the selected curve changes to 15, so how do I get the right parameters for the curve I created.
GeomAPI_PointsToBSpline Approx(Poles, 3, 8, GeomAbs_C2);
curve = Approx.Curve();
int oricurve = curve->NbPoles();
int degree = curve->Degree();
int knots = curve->NbKnots();
Handle(Geom_Curve) projectedCurve = GeomProjLib::Project(curve, surface);
TopoDS_Edge ed1 = BRepBuilderAPI_MakeEdge(projectedCurve);
//TopoDS_Wire wr1 = BRepBuilderAPI_MakeWire(ed1);
Handle(AIS_Shape) red = new AIS_Shape(ed1);
view->getContext()->SetColor(red, Quantity_NOC_RED, Standard_True);
view->getContext()->Display(red, Standard_True);
void View::mousePressEvent(QMouseEvent* theEvent)
{
if (theEvent->button() == Qt::LeftButton)
{
onLButtonDown((theEvent->buttons() | theEvent->modifiers()), theEvent->pos());
if (m_context->HasDetectedShape()) {
abc = m_context->DetectedShape();
TopAbs_ShapeEnum ShapeType = abc.ShapeType();
if (ShapeType == TopAbs_EDGE) {
crv = TopoDS::Edge(abc);
}
}
}
if (!crv.IsNull()) {
crvpath = true;
TopAbs_ShapeEnum ShapeType = crv.ShapeType();
Standard_Real first, last;
Handle(Geom_Curve) curve = BRep_Tool::Curve(crv,first, last);
if (curve->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
{
//Geom_BSplineCurve
Handle(Geom_BSplineCurve) bsplineCurve = Handle(Geom_BSplineCurve)::DownCast(curve);
int polesize = bsplineCurve->NbPoles();
int c = bsplineCurve->NbKnots();
Sun, 04/21/2024 - 07:14
I don't quite understand how is your question relate to visualization. Aren't you compare some curve with it's protection into a surface (via
GeomProjLib::Project
)? Why would they have the same properties?