VRotaryLimitJoint¶
Qualified name: manim\_pymunk.constraints.VRotaryLimitJoint
- class VRotaryLimitJoint(a_mob, b_mob, min_angle=-0.7853981633974483, max_angle=0.7853981633974483, arc_indicator_class=<class 'manim.mobject.geometry.arc.Arc'>, arc_indicator_config={'color': ManimColor('#F7D96F'), 'radius': 0.5, 'stroke_width': 2}, **kwargs)[source]¶
Bases:
VConstraintInitializes a Rotary Limit Joint constraint between two Mobjects.
This joint constrains the relative rotation between two bodies to stay within a specific angular range. It acts as a physical stop when the bodies reach the minimum or maximum angle limits.
Parameters¶
- a_mob
The first Mobject (the reference body).
- b_mob
The second Mobject (the constrained body).
- min_angle
The minimum allowed relative angle (in radians).
- max_angle
The maximum allowed relative angle (in radians).
- arc_indicator_class
The Manim class used to visualize the angular limits (typically Arc). Set to None to hide the visual representation.
- arc_indicator_config
Configuration dictionary for the styling of the visual arc.
Examples¶
Example: VRotaryLimitJointExample ¶
from manim import * from manim_pymunk import * class VRotaryLimitJointExample(SpaceScene): def construct(self): static_dot = Dot(ORIGIN) square = Square().move_to(static_dot) square2 = Square().move_to(static_dot.get_center() + UP * 2).scale(0.5) constraints = [ VPinJoint(static_dot, square), VPinJoint( square, square2, anchor_a_local=square.get_corner(UR) - square.get_center(), distance=2, connect_line_class=Line, ), VRotaryLimitJoint( static_dot, square2, min_angle=-PI / 6, max_angle=PI / 6, ), ] self.add_static_body(static_dot) self.add_dynamic_body(square, square2, angular_velocity=PI * 2) self.add_shapes_filter(static_dot, square, square2, group=2) self.add_constraints(*constraints) self.wait(3)
from manim_pymunk import * class VRotaryLimitJointExample(SpaceScene): def construct(self): static_dot = Dot(ORIGIN) square = Square().move_to(static_dot) square2 = Square().move_to(static_dot.get_center() + UP * 2).scale(0.5) constraints = [ VPinJoint(static_dot, square), VPinJoint( square, square2, anchor_a_local=square.get_corner(UR) - square.get_center(), distance=2, connect_line_class=Line, ), VRotaryLimitJoint( static_dot, square2, min_angle=-PI / 6, max_angle=PI / 6, ), ] self.add_static_body(static_dot) self.add_dynamic_body(square, square2, angular_velocity=PI * 2) self.add_shapes_filter(static_dot, square, square2, group=2) self.add_constraints(*constraints) self.wait(3)Methods
installInstalls physical constraints into the Pymunk physical space.
mob_updaterVisual control updater
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- __check_data()¶
Verify the validity of constraint parameters.
- _abc_impl = <_abc._abc_data object>¶
- _bezier_t_values: npt.NDArray[float]¶
- _original__init__(a_mob, b_mob, min_angle=-0.7853981633974483, max_angle=0.7853981633974483, arc_indicator_class=<class 'manim.mobject.geometry.arc.Arc'>, arc_indicator_config={'color': ManimColor('#F7D96F'), 'radius': 0.5, 'stroke_width': 2}, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
a_mob (Mobject)
b_mob (Mobject)
min_angle (float)
max_angle (float)
arc_indicator_class (Arc | None)
arc_indicator_config (dict)
- animation_overrides = {}¶
- arc_indicator_a: VMobject | None¶
- arc_indicator_b: VMobject | None¶
- background_image: Image | str | None¶
- background_stroke_color: ManimColor¶
- background_stroke_opacity: float¶
- background_stroke_width: float¶
- cap_style: CapStyleType¶
- close_new_points: bool¶
- constraint: RotaryLimitJoint | None¶
- install(space)[source]¶
Installs physical constraints into the Pymunk physical space. This method should be overridden by subclasses to implement the following:
Create Pymunk constraint objects
Initialize the vision component
Add constraints to the physical space
Bind an updater to keep the vision synchronized.
- Parameters:
space (Space)
- joint_type: LineJointType¶
- make_smooth_after_applying_functions: bool¶
- n_points_per_cubic_curve: int¶
- pre_function_handle_to_anchor_scale_factor: float¶
- shade_in_3d: bool¶
- submobjects: list[VMobject]¶
- tolerance_for_point_equality: float¶
- Parameters:
a_mob (Mobject)
b_mob (Mobject)
min_angle (float)
max_angle (float)
arc_indicator_class (Arc | None)
arc_indicator_config (dict)