Create a 3D curve from a 2D curve


#1

For a 2d curve whose image lies in the surface’s domain, how to create a 3D curve from it? In other words, how to create a 3D curve from the following p2DCurve and srf?

ON_Curve* p2DCurve = …;
const ON_Surface& srf = …;

When creating a ON_Brep, does it require the corresponding 3D edge for each 2D curve? In other words, is it possible to use the following API to create the ON_BrepTrim (without the corresponding edge)?

ON_BrepTrim& ON_Brep::NewTrim(
bool bRev3d,
ON_BrepLoop& loop,
int c2i = -1
);


(Dale Fugier) #2

Hi @XNurbs,

1.) To compute a 3d curve that is the composite of a 2d curve and the surface map, use ON_Surface::Pushup.

2.)

Yes. However, if your Brep has no edge curves and you call the above member function, then it’s assumed this is the only trim using this edge and ON trim.m_type will be set to ON_BrepTrim::boundary. This type will be changed to ON_BrepTrim::seam or ON_BrepTrim::mated when another trim is added that uses this edge.

– Dale


#3

Could you tell why ON_CurveOnSurface won’t work?
The following code works for edges:

	ON_Curve * prn3DCurve = prnSurf->Pushup(*prn2DCurve, 0.001);
	int i3DCurveIndex = prnBrep->m_C3.Count();
	prnBrep->m_C3.Append(prn3DCurve);

	ON_BrepEdge& rnEdge = prnBrep->NewEdge(prnBrep->m_V[iStartVertexIndex], prnBrep->m_V[iEndVertexIndex], i3DCurveIndex);

ON_CurveOnSurface won’t work:

	ON_CurveProxy * pCurveProxy = new ON_CurveProxy(prn2DCurve);
	ON_SurfaceProxy * pSurfaceProxy = new ON_SurfaceProxy(prnSurf);
	ON_Curve * prn3DCurve = new ON_CurveOnSurface(pCurveProxy, NULL, pSurfaceProxy);
	int i3DCurveIndex = prnBrep->m_C3.Count();
	prnBrep->m_C3.Append(prn3DCurve);

	ON_BrepEdge& rnEdge = prnBrep->NewEdge(prnBrep->m_V[iStartVertexIndex], prnBrep->m_V[iEndVertexIndex], i3DCurveIndex);

(Dale Fugier) #4

Hi @XNurbs,

The ON_CurveOnSurface is not applicable for this problem.

– Dale