I'd like to build a BSpline curve in the parametric space of a surface, but I don'tb know the method to do it and the classes I have to use.
Perhaps someone could help me...
axyl (not verified) Fri, 04/08/2005 - 16:18
As far as I know, OpenCascade can project a 3D curve on a planar surface using its methods in BRepAlgoAPI package. It uses surface normals, for projection direction. It uses the algorithms in the Extrema package to determine the mapping. However, I suggest you alternatively write a (generic) sub-program that does the following:
1) input the curve (C1) you want to project on surface of OpennCascade
2) input the surface (S1) onto which you want to project the curve, C1
3) input the direction of the projection (using gp_Dir (D) from the gp package). This you can define, either by means of
(i) some surface (s1) normal at some convenient parametric position (if you still want details on this please send the question on the site again) or
(ii) your view direction, or
(iii) even using your currently active (construction) plane normal
4) with this information, use C1 and D to define a SurfaceOfLinearExtrusion [S2](say from Geom package or GeomAdaptor package)
5) Intersect S2 with S1 using the surface/surface intersection routine (see OpenCascade documentation)
6) select which curve you want to use (in cases where you have more than one intersection)
Good luck!
Note that in the intersection package, you get
a) a 3d curve on the surface,
b) 2d curves in the parametric space of respective surfaces S1,S2
c) etc
That depends upon what you mean by building in parametric space.
Handle (Geom2d_BSplineCurve) aCurve = new Geom2d_BSplineCurve (...) can be just fine, but there is no connection to the surface parametric space.
1). If you want to restore 3D curve from 2D curve in parametric space (i.e. to have a curve lying on your surface) then construct a TopoDS_Edge (using BRep-Builder and feeding it with 2D curve and surface), build 3d curve using BRepLib::BuildCurve3d() (or safer one ShapeFix_Edge::FixAddCurve3d()).
2). If you indeed need to project some 3D curve on surface then consult the doc (I believe the previous post by axyl would be "reinventing the wheel") for projection. The other option is to use ShapeFix::AddPCurve(). There are several signatures - choose one which fits you best (again you will need to construct an edge to give to the algo).
Hello Manu,
I agree with Roman on:
1) building the 2d curve
2) projection of curve on surface
I, however, have a problem agreeing with him on (2) completely. Recall, I say for a (generic) solution? Even the methods Roman refers to for the projection, those work for planar surfaces, otherwise you have to wait indefinately for projections on other surfaces (in other words fails). In addition, when you use surface normals to project, you will have a 'distance effect' for non-planar surfaces. The further your curve is from the surface the morethe distorion, e.g. try projecting a circle onto a cylinder using the surface normals and the (working) method I suggest! I agree using the BRep package method works for plana surfaces as far as I know. Can OpenCascade give me advice otherwise?
Hello Manu,
I agree with Roman on:
1) building the 2d curve
2) projection of curve on surface
I, however, have a problem agreeing with him on (2) completely. Recall, I say for a (generic) solution? Even the methods Roman refers to for the projection, those work for planar surfaces, otherwise you have to wait indefinately for projections on other surfaces (in other words it fails). In addition, when you use surface normals to project, you will have a 'distance effect' for non-planar surfaces. The further your curve is from the surface the more the distortion, e.g. try projecting a circle onto a cylinder using the surface normals (if it works) and the (working) method I suggest! I agree using the BRep package method works for planar surfaces as far as I know. Can OpenCascade give me advice otherwise?
Fri, 04/08/2005 - 16:18
As far as I know, OpenCascade can project a 3D curve on a planar surface using its methods in BRepAlgoAPI package. It uses surface normals, for projection direction. It uses the algorithms in the Extrema package to determine the mapping. However, I suggest you alternatively write a (generic) sub-program that does the following:
1) input the curve (C1) you want to project on surface of OpennCascade
2) input the surface (S1) onto which you want to project the curve, C1
3) input the direction of the projection (using gp_Dir (D) from the gp package). This you can define, either by means of
(i) some surface (s1) normal at some convenient parametric position (if you still want details on this please send the question on the site again) or
(ii) your view direction, or
(iii) even using your currently active (construction) plane normal
4) with this information, use C1 and D to define a SurfaceOfLinearExtrusion [S2](say from Geom package or GeomAdaptor package)
5) Intersect S2 with S1 using the surface/surface intersection routine (see OpenCascade documentation)
6) select which curve you want to use (in cases where you have more than one intersection)
Good luck!
Note that in the intersection package, you get
a) a 3d curve on the surface,
b) 2d curves in the parametric space of respective surfaces S1,S2
c) etc
Fri, 04/08/2005 - 19:37
Hello Manu,
That depends upon what you mean by building in parametric space.
Handle (Geom2d_BSplineCurve) aCurve = new Geom2d_BSplineCurve (...) can be just fine, but there is no connection to the surface parametric space.
1). If you want to restore 3D curve from 2D curve in parametric space (i.e. to have a curve lying on your surface) then construct a TopoDS_Edge (using BRep-Builder and feeding it with 2D curve and surface), build 3d curve using BRepLib::BuildCurve3d() (or safer one ShapeFix_Edge::FixAddCurve3d()).
2). If you indeed need to project some 3D curve on surface then consult the doc (I believe the previous post by axyl would be "reinventing the wheel") for projection. The other option is to use ShapeFix::AddPCurve(). There are several signatures - choose one which fits you best (again you will need to construct an edge to give to the algo).
HTH.
Roman
Mon, 04/11/2005 - 14:09
Thank you very much,
My curve is now perfect.
Mon, 04/11/2005 - 17:18
Hello Manu,
I agree with Roman on:
1) building the 2d curve
2) projection of curve on surface
I, however, have a problem agreeing with him on (2) completely. Recall, I say for a (generic) solution? Even the methods Roman refers to for the projection, those work for planar surfaces, otherwise you have to wait indefinately for projections on other surfaces (in other words fails). In addition, when you use surface normals to project, you will have a 'distance effect' for non-planar surfaces. The further your curve is from the surface the morethe distorion, e.g. try projecting a circle onto a cylinder using the surface normals and the (working) method I suggest! I agree using the BRep package method works for plana surfaces as far as I know. Can OpenCascade give me advice otherwise?
Mon, 04/11/2005 - 17:22
Hello Manu,
I agree with Roman on:
1) building the 2d curve
2) projection of curve on surface
I, however, have a problem agreeing with him on (2) completely. Recall, I say for a (generic) solution? Even the methods Roman refers to for the projection, those work for planar surfaces, otherwise you have to wait indefinately for projections on other surfaces (in other words it fails). In addition, when you use surface normals to project, you will have a 'distance effect' for non-planar surfaces. The further your curve is from the surface the more the distortion, e.g. try projecting a circle onto a cylinder using the surface normals (if it works) and the (working) method I suggest! I agree using the BRep package method works for planar surfaces as far as I know. Can OpenCascade give me advice otherwise?