Annular Sector¶
- class AnnularSector(center: Point, inner_radius: float, outer_radius: float, start_angle: float, angle: float, plane: PolarPlane, **kwargs)[source]¶
Basically a thick circular
Arc
.- Parameters:
center – A
hmanim.poincare.point.Point
representing the center of the circle that theAnnularSector
lives in.inner_radius – A float representing the radius from which on the sector extends.
outer_radius – A float representing the radius up to which the sector extends.
start_angle – A float representing the angle at which the sector starts.
angle – A float representing the angular width of the sector, i.e., how far it extends from the start_angle.
plane – The
PolarPlane
in which theAnnularSector
lives.
Examples
Example: AnnularSectorExample ¶
from manim import * from hmanim.native import AnnularSector, Point class AnnularSectorExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector)
from hmanim.native import AnnularSector, Point class AnnularSectorExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector)
- property center: Point¶
The center of the annular sector.
- Returns:
The center of the annular sector.
- Return type:
- copy() AnnularSector [source]¶
Copy the annular sector including all properties.
- Returns:
The copied annular sector.
- Return type:
- rotated_by(angle: float) AnnularSector [source]¶
Rotates the annular sector by the given angle around the origin.
- Parameters:
angle (float) – The angle in radians to rotate by.
- Returns:
The rotated annular sector.
- Return type:
- set_angle(angle: float) AnnularSector [source]¶
Change the angle by which the annular sector is extends.
- Parameters:
angle (float) – The angle in radians.
- Returns:
The annular sector with the new angle.
- Return type:
- set_inner_radius(inner_radius: float) AnnularSector [source]¶
Define the inner radius of the annular sector.
- Parameters:
inner_radius (float) – The new inner radius of the annular sector.
- Returns:
The annular sector with the new inner radius.
- Return type:
- set_outer_radius(outer_radius: float) AnnularSector [source]¶
Define the outer radius of the annular sector.
- Parameters:
outer_radius (float) – The new outer radius of the annular sector.
- Returns:
The annular sector with the new outer radius.
- Return type:
- set_parameters(inner_radius: float, outer_radius: float, start_angle: float, angle: float) AnnularSector [source]¶
Change multiple of the parameters of the annular sector simultaneously.
- Parameters:
inner_radius (float) – The new inner radius.
outer_radius (float) – The new outer radius.
start_angle (float) – The new start angle.
angle (float) – The new angle.
- Returns:
The annular sector with the new parameters.
- Return type:
- set_start_angle(start_angle: float) AnnularSector [source]¶
Change at which angle the sector starts.
- Parameters:
start_angle (float) – The starting angle in radians.
- Returns:
The annular sector with the new start angle.
- Return type:
- translated_by(distance: float) AnnularSector [source]¶
Moves the annular sector by the given distance in x-direction.
- Parameters:
distance (float) – How far to translate.
- Returns:
The translated annular sector.
- Return type:
- class AnnularSectorStretchAngle(mobject=None, *args, use_override=True, **kwargs)[source]¶
Animate the change of the angular width that a
AnnularSector
spans.Examples
Example: AnnularSectorStretchAngleExample ¶
from manim import * from hmanim.native import AnnularSector, AnnularSectorStretchAngle, Point class AnnularSectorStretchAngleExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchAngle( sector, angle=TAU / 4, run_time=3 ) )
from hmanim.native import AnnularSector, AnnularSectorStretchAngle, Point class AnnularSectorStretchAngleExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchAngle( sector, angle=TAU / 4, run_time=3 ) )
- interpolate_mobject(alpha: float)[source]¶
Interpolates the mobject of the
Animation
based on alpha value.- Parameters:
alpha – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.
- class AnnularSectorStretchAngleInverse(mobject=None, *args, use_override=True, **kwargs)[source]¶
Like stretch angle but stretches in the inverse direction.
Examples
Example: AnnularSectorStretchAngleInverseExample ¶
from manim import * from hmanim.native import AnnularSector, AnnularSectorStretchAngleInverse, Point class AnnularSectorStretchAngleInverseExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchAngleInverse( sector, angle=TAU / 4, run_time=3 ) )
from hmanim.native import AnnularSector, AnnularSectorStretchAngleInverse, Point class AnnularSectorStretchAngleInverseExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchAngleInverse( sector, angle=TAU / 4, run_time=3 ) )
- class AnnularSectorStretchRadiiAndAngleInverse(mobject=None, *args, use_override=True, **kwargs)[source]¶
Like stretch angle but stretches in the inverse direction and adjusts the radii simultaneously.
Examples
Example: AnnularSectorStretchRadiiAndAngleInverseExample ¶
from manim import * from hmanim.native import AnnularSector, AnnularSectorStretchRadiiAndAngleInverse, Point class AnnularSectorStretchRadiiAndAngleInverseExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchRadiiAndAngleInverse( sector, inner_radius=2.0, angle=TAU / 4, run_time=3 ) )
from hmanim.native import AnnularSector, AnnularSectorStretchRadiiAndAngleInverse, Point class AnnularSectorStretchRadiiAndAngleInverseExample(Scene): def construct(self): # The plane that all our hyperbolic objects live in. plane = PolarPlane(size=5) # Draw the sector. sector = AnnularSector( center=Point(), inner_radius=1.0, outer_radius=3.0, start_angle=0.0, angle=TAU / 8, plane=plane ) self.add(sector) # Stretch the sector. self.play( AnnularSectorStretchRadiiAndAngleInverse( sector, inner_radius=2.0, angle=TAU / 4, run_time=3 ) )
- interpolate_mobject(alpha: float)[source]¶
Interpolates the mobject of the
Animation
based on alpha value.- Parameters:
alpha – A float between 0 and 1 expressing the ratio to which the animation is completed. For example, alpha-values of 0, 0.5, and 1 correspond to the animation being completed 0%, 50%, and 100%, respectively.