Mantis issue 0021865: Adding tangency in Spline creation

This commit is contained in:
jfa 2012-12-14 12:54:25 +00:00
parent 4e75612208
commit 6a75f2c870
2 changed files with 14 additions and 6 deletions

View File

@ -77,8 +77,8 @@ if two above check boxes are not checked.
</ul>
\n <b>TUI Command:</b>
<em>geompy.MakeInterpol(ListOfShapes,isClosed,doReordering)</em>
<em>geompy.MakeInterpolWithTangents(ListOfShapes,Vector1,Vector2)</em>
<br><em>geompy.MakeInterpol(ListOfShapes,isClosed,doReordering)</em>
<br><em>geompy.MakeInterpolWithTangents(ListOfShapes,Vector1,Vector2)</em>
<b>Analytical Definition</b>

View File

@ -215,13 +215,16 @@ import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create vertices
# create vertices and vectors
p0 = geompy.MakeVertex(0. , 0. , 0. )
p1 = geompy.MakeVertex(50. , 100., 200.)
p2 = geompy.MakeVertex(150., 50., 100.)
p3 = geompy.MakeVertex(100., 150., 170.)
p4 = geompy.MakeVertex(200., 200., 150.)
v1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
v2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
# create a polyline from a list of points
polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
@ -231,32 +234,36 @@ bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
#create a b-spline curve from a list of points
interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
#create a b-spline curve with defined directions at the ends
interpol_tangents = geompy.MakeInterpolWithTangents([p0, p1, p2, p3, p4], v1, v2)
#create a polyline using parametric definition of the basic points
param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
# create a bezier curve using parametric definition of the basic points
param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Bezier, theNewMethod=True)
param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 20, geompy.GEOM.Bezier, theNewMethod=True)
#create a b-spline curve using parametric definition of the basic points
param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True)
# add objects in the study
id_p0 = geompy.addToStudy(p0, "Point1")
id_p1 = geompy.addToStudy(p1, "Point2")
id_p2 = geompy.addToStudy(p2, "Point3")
id_p3 = geompy.addToStudy(p3, "Point4")
id_p4 = geompy.addToStudy(p4, "Point5")
id_v1 = geompy.addToStudy(v1, "Vector1")
id_v2 = geompy.addToStudy(v2, "Vector2")
id_polyline = geompy.addToStudy(polyline, "Polyline")
id_bezier = geompy.addToStudy(bezier, "Bezier")
id_interpol = geompy.addToStudy(interpol, "Interpol")
id_interpol_tangents = geompy.addToStudy(interpol_tangents, "Interpol Tangents")
id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
# display the points and the curves
gg.createAndDisplayGO(id_p0)
gg.createAndDisplayGO(id_p1)
@ -266,6 +273,7 @@ gg.createAndDisplayGO(id_p4)
gg.createAndDisplayGO(id_polyline)
gg.createAndDisplayGO(id_bezier)
gg.createAndDisplayGO(id_interpol)
gg.createAndDisplayGO(id_interpol_tangents)
gg.createAndDisplayGO(id_param_polyline)
gg.createAndDisplayGO(id_param_bezier)
gg.createAndDisplayGO(id_param_interpol)