You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the grinding wheel swept along the helix, I set the align_rotations_with_velocity to True and False respectively, and the result of True is a bit strange. Following is my code:
importpolyscopefromtest.contextimportgpytoolboxfromtest.contextimportnumpyasnpfromtest.contextimportunittestfromgpytoolboximportread_meshfromgpytoolbox.copyleftimportswept_volumefromgpytoolbox.copyleftimportmesh_booleanfromgpytoolbox.copyleftimportdo_meshes_intersectimportpolyscopeaspsps.init()
# Read sample meshv, f=gpytoolbox.read_mesh("D:/pycharmpro/gpytoolbox/test/unit_tests_data/wheel.obj")
ps.register_surface_mesh("Wheel",v,f)
# Translation vectors to make Catmull-Rom splinedefgenerate_spiral_translations(radius, start_y, end_y, num_steps, pitch):
""" Generate translation vectors along a helical path around the y-axis, with specified start and end y-coordinates. Parameters: radius (float): Radius of the helix in the xz-plane. start_y (float): Starting y-coordinate of the helix. end_y (float): Ending y-coordinate of the helix. num_steps (int): Number of steps along the helix. pitch (float): Vertical distance (height) for one full rotation around the y-axis. Returns: translations (np.ndarray): Array of translation vectors (x, y, z). """# Calculate the height per steptotal_height=end_y-start_yh_step=total_height/num_steps# Initialize an empty array to store the translationstranslations=np.zeros((num_steps, 3))
# Generate the translationsforiinrange(num_steps):
# Calculate the angle for the current step# Use pitch to determine the angle per step, considering the full height of the helixtheta=2*np.pi*i/ (num_steps*pitch)
# Calculate the x and z coordinates based on the angle and radiusx=radius*np.cos(theta)
z=radius*np.sin(theta)
y=start_y+i*h_step# Adjust y based on start_y and step height# Store the translation vectortranslations[i] = [x, y, z]
returntranslations# Example usageradius=0.025start_y=-0.07end_y=0.07num_steps=50pitch=0.2# Controls the number of rotations over the heighttranslations=generate_spiral_translations(radius, start_y, end_y, num_steps, pitch)
# Call swept volume functionu1,g1=swept_volume(v,f,rotations=None,translations=translations,eps=0.001,verbose=True,align_rotations_with_velocity=True)
ps.register_surface_mesh("Swept_Volume1",u1,g1)
u2,g2=swept_volume(v,f,rotations=None,translations=translations,eps=0.001,verbose=True,align_rotations_with_velocity=False)
ps.register_surface_mesh("Swept_Volume2",u2,g2)
ps.show()
The result:
align_rotations_with_velocity=True
align_rotations_with_velocity=False
It looks like one side is normal, and the other side is wrong. I don't know if it's due to my helix generation function. You can try to set a sweep with a path as a spiral and see if a similar problem occurs?
The text was updated successfully, but these errors were encountered:
Hi! This is an interesting result: it definitely seems like a bug in the code that orients the shape with its velocity vector. I will take a look once I have a minute. Please try to use it with align_rotations_with_velocity=False for now
When the grinding wheel swept along the helix, I set the align_rotations_with_velocity to True and False respectively, and the result of True is a bit strange. Following is my code:
The result:
align_rotations_with_velocity=True
align_rotations_with_velocity=False
It looks like one side is normal, and the other side is wrong. I don't know if it's due to my helix generation function. You can try to set a sweep with a path as a spiral and see if a similar problem occurs?
The text was updated successfully, but these errors were encountered: