diff --git a/manimlib/constants.py b/manimlib/constants.py index aaa2e50b..fbb14f1a 100644 --- a/manimlib/constants.py +++ b/manimlib/constants.py @@ -65,8 +65,8 @@ RADIANS: float = 1 FFMPEG_BIN: str = "ffmpeg" JOINT_TYPE_MAP: dict = { - "auto": 0, - "round": 1, + "no_joint": 0, + "auto": 1, "bevel": 2, "miter": 3, } diff --git a/manimlib/mobject/functions.py b/manimlib/mobject/functions.py index 5007ced7..5ccb24db 100644 --- a/manimlib/mobject/functions.py +++ b/manimlib/mobject/functions.py @@ -93,9 +93,10 @@ class ImplicitFunction(VMobject): min_depth: int = 5, max_quads: int = 1500, use_smoothing: bool = True, + joint_type: str = 'no_joint', **kwargs ): - super().__init__(**kwargs) + super().__init__(joint_type=joint_type, **kwargs) p_min, p_max = ( np.array([x_range[0], y_range[0]]), diff --git a/manimlib/mobject/three_dimensions.py b/manimlib/mobject/three_dimensions.py index 49cba1e3..01bcc807 100644 --- a/manimlib/mobject/three_dimensions.py +++ b/manimlib/mobject/three_dimensions.py @@ -38,6 +38,7 @@ class SurfaceMesh(VGroup): normal_nudge: float = 1e-2, flat_stroke: bool = False, depth_test: bool = True, + joint_type: str = 'no_joint', **kwargs ): self.uv_surface = uv_surface @@ -49,6 +50,7 @@ class SurfaceMesh(VGroup): stroke_color=stroke_color, stroke_width=stroke_width, depth_test=depth_test, + joint_type=joint_type, **kwargs ) @@ -291,7 +293,7 @@ class VGroup3D(VGroup): gloss: float = 0.2, shadow: float = 0.2, reflectiveness: float = 0.2, - joint_type: str = "round", + joint_type: str = "no_joint", **kwargs ): super().__init__(*vmobjects, **kwargs) diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py index 4d132396..fbea2fe3 100644 --- a/manimlib/mobject/types/vectorized_mobject.py +++ b/manimlib/mobject/types/vectorized_mobject.py @@ -84,7 +84,7 @@ class VMobject(Mobject): draw_stroke_behind_fill: bool = False, background_image_file: str | None = None, long_lines: bool = False, - # Could also be "bevel", "miter", "round" + # Could also be "no_joint", "bevel", "miter" joint_type: str = "auto", flat_stroke: bool = False, # Measured in pixel widths diff --git a/manimlib/shaders/quadratic_bezier_stroke/geom.glsl b/manimlib/shaders/quadratic_bezier_stroke/geom.glsl index 89142acd..fe0901f9 100644 --- a/manimlib/shaders/quadratic_bezier_stroke/geom.glsl +++ b/manimlib/shaders/quadratic_bezier_stroke/geom.glsl @@ -36,10 +36,10 @@ out float is_linear; out vec2 uv_coords; // Codes for joint types -const float AUTO_JOINT = 0; -const float ROUND_JOINT = 1; -const float BEVEL_JOINT = 2; -const float MITER_JOINT = 3; +const int NO_JOINT = 0; +const int AUTO_JOINT = 1; +const int BEVEL_JOINT = 2; +const int MITER_JOINT = 3; const float PI = 3.141592653; const float DISJOINT_CONST = 404.0; @@ -56,10 +56,10 @@ void create_joint(float angle, vec2 unit_tan, float buff, vec2 static_c0, out vec2 changing_c0, vec2 static_c1, out vec2 changing_c1){ float shift; - if(abs(angle) < ANGLE_THRESHOLD){ + if(abs(angle) < ANGLE_THRESHOLD || int(joint_type) == NO_JOINT){ // No joint shift = 0; - }else if(joint_type == MITER_JOINT || (joint_type == AUTO_JOINT && angle > 0.9 * PI)){ + }else if(int(joint_type) == MITER_JOINT || (int(joint_type) == AUTO_JOINT && angle > 0.9 * PI)){ shift = buff * (-1.0 - cos(angle)) / sin(angle); }else{ // For a Bevel joint