def letter_o(): outer = curve2d.full_circle(radius=10.0) operations.translate(outer, (2, 0), inplace=True) inner = curve2d.full_circle(radius=8.0) operations.translate(inner, (2, 0), inplace=True) letter = Multi.MultiCurve() letter.add([outer, inner]) return letter
def run(N, weight): N = N circle = create_curve(N) print(circle) weight = math.cos(math.pi / N) + weight cv = Multi.MultiCurve() k = 0 while k < len(circle) - 1: cv.add( create_bezie_curve(circle[k], circle[k + 1], circle[k + 2], weight)) k = k + 2 vis_compl = VisMPL.VisCurve2D() cv.vis = vis_compl cv.render()
def letter_i(): base = NURBS.Curve() base.degree = 3 base.ctrlptsw = [[1, 20, 1], [0, 10, 0.5], [0, 19, 1], [0, 10, 1], [0, 1, 1], [0, 0, 0.5], [1, 0, 1], [1, 0, 0.5], [2, 1, 1], [2, 10, 1], [2, 19, 1], [1, 10, 0.5], [1, 20, 1]] base.knotvector = utilities.generate_knot_vector(base.degree, len(base.ctrlpts)) hat = curve2d.full_circle(radius=1) operations.translate(hat, (1, 22), inplace=True) letter = Multi.MultiCurve() letter.add([base, hat]) return letter
def draw_curves(self, curvespts): # Try to load the visualization module try: render_curve = True from geomdl.visualization import VisMPL except ImportError: render_curve = False # Plot the curves using the curve container curves = Multi.MultiCurve() curves.delta = 0.01 for curve in curvespts: curves.add(curve) if render_curve: vis_comp = VisMPL.VisCurve3D() curves.vis = vis_comp curves.render()
def default(): # Create the heart heart = generate_heart() print( "Question 1: generating and displaying a heart at scales of [0.5, 1, 2]." ) # Display the heart at three scales heart_1 = generate_heart(0.5) heart_1.name = 'Scale: 0.5' heart_2 = generate_heart(1) heart_2.name = 'Scale: 1' heart_3 = generate_heart(2) heart_3.name = 'Scale: 2' # Set up a MultiCurve to allow displaying all three hearts on one plot three_hearts = Multi.MultiCurve() three_hearts.delta = 0.001 three_hearts.add([heart_1, heart_2, heart_3]) # Display the MultiCurve display_curve(three_hearts)
compute_reactions, reform_dofs_at_each_iteration, move_mesh_flag) solver.SetEchoLevel(1) num_pole = curve_geometry.NbPoles num_load_steps = 10 disp_X = [] disp_Y = [] disp_Z = [] disp_X = np.empty([num_load_steps + 1, num_pole]) disp_Y = np.empty([num_load_steps + 1, num_pole]) disp_Z = np.empty([num_load_steps + 1, num_pole]) # PLOT _________________________________________________________________________________ multi_curve = Multi.MultiCurve() for i in range(0, num_load_steps + 1): F = i * 0.01 / num_load_steps moment_vec = [i * 10 / num_load_steps, 0, 0] model_part.GetNode(curve_geometry.NbPoles).SetSolutionStepValue( POINT_LOAD_Z, F) # model_part.GetElement(n+2) # element_load_properties.SetValue(LOAD_VECTOR_MOMENT, moment_vec) # aktuellen modellzustand kopieren model_part.CloneTimeStep(i + 1) # aktuellen zustand lösen print("solver step: ", i)
curve.delta = 0.01 # Set up curve curve.read_ctrlpts_from_txt("ex_curve02.cpt") curve.degree = 3 # Auto-generate knot vector curve.knotvector = utilities.generate_knot_vector(curve.degree, len(curve.ctrlpts)) # Split the curve curve1, curve2 = curve.split(0.2) # Move the 1st curve a little bit far away from the 2nd curve c2tan = curve2.tangent(0.0, normalize=True) c2tanvec = [-1 * p for p in c2tan[1]] curve1.translate(c2tanvec) # Plot the curves using the curve container curves = Multi.MultiCurve() curves.delta = 0.01 curves.add(curve1) curves.add(curve2) if render_curve: vis_comp = VisMPL.VisCurve2D() curves.vis = vis_comp curves.render() # Good to have something here to put a breakpoint pass
To display several scales in one plot, with control points, type 'multi_points', followed by your desired scales (one per line), followed by 'plot'\n\ To display several scales in one plot, without control points, type 'multi_no_points', then proceed as above\n\ To quit this program, type 'quit'\n\ Input: ").lower() if UserInput == 'quit' or UserInput == 'q' or UserInput == 'exit': # Exit the program print('Quitting Question 1 program.') break elif UserInput == 'default': # Display the heart at three scales default() elif UserInput == 'multi_points': # Display multiple scales on one plot, with control points showing # Create the multi curve multi_heart = Multi.MultiCurve() multi_heart.delta = 0.001 # Enter a while loop to capture each input scale user_quits = False while (True): UserInput = input("Next scale value: ").lower() if UserInput == 'plot': # Leave the loop with user_quits = False break elif UserInput == 'quit' or UserInput == 'q' or UserInput == 'exit': print('Quitting Question 1 program.') user_quits = True break else: # Expect a scale value input try:
def run(self, N, weight): cv = Multi.MultiCurve() cv.add(self.create_bezie_curve(self.lst[0], self.lst[1], self.lst[2], weight)) vis_compl = VisMPL.VisCurve2D() cv.vis = vis_compl cv.render()