# Set up the curve curve.degree = 3 curve.ctrlpts = exchange.import_txt("ex_curve03.cpt") # Auto-generate knot vector curve.knotvector = utilities.generate_knot_vector(curve.degree, len(curve.ctrlpts)) # Set evaluation delta curve.delta = 0.01 # Evaulate curve curve.evaluate() # Draw the control point polygon and the evaluated curve vis_comp = VisPlotly.VisCurve2D() curve.vis = vis_comp curve.render() # Evaluate curve tangent at u = 0.0 curvetan1 = operations.tangent(curve, 0.0, normalize=True) # Evaluate curve tangent at u = 0.2 curvetan2 = operations.tangent(curve, 0.2, normalize=True) # Evaluate curve tangent at u = 0.5 curvetan3 = operations.tangent(curve, 0.5, normalize=True) # Evaluate curve tangent at u = 0.6 curvetan4 = operations.tangent(curve, 0.6, normalize=True)
# Fix file path os.chdir(os.path.dirname(os.path.realpath(__file__))) # Create a BSpline curve instance curve = BSpline.Curve() # Set degree curve.degree = 3 # Read control points from a file curve.ctrlpts = exchange.import_txt("ex_curve03.cpt") # Set knot vector curve.knotvector = [0, 0, 0, 0, 0.25, 0.25, 0.5, 0.75, 0.75, 1, 1, 1, 1] # Decompose the curve curve_list = operations.decompose_curve(curve) curve_decomposed = multi.CurveContainer(curve_list) # Set sample size for the decomposed curve curve_decomposed.sample_size = 25 # Plot the decomposed curve vis_comp = vis.VisCurve2D() curve_decomposed.vis = vis_comp curve_decomposed.render() # Good to have something here to put a breakpoint pass
from geomdl.visualization import VisPlotly as plotter # Fix file path os.chdir(os.path.dirname(os.path.realpath(__file__))) # Create a BSpline curve instance curve = BSpline.Curve() # Set degree curve.degree = 3 # Read control points from a file curve.ctrlpts = exchange.import_txt("ex_curve03.cpt") # Set knot vector curve.knotvector = [0, 0, 0, 0, 0.25, 0.25, 0.5, 0.75, 0.75, 1, 1, 1, 1] # Decompose the curve curve_decomposed = operations.decompose_curve(curve) # Set sample size for the decomposed curve curve_decomposed.sample_size = 25 # Plot the decomposed curve vis_comp = plotter.VisCurve2D() curve_decomposed.vis = vis_comp curve_decomposed.render() # Good to have something here to put a breakpoint pass