AnAnimLib API Reference
Animate
Consider the following script.
1import ananimlib as al
2
3al.Animate(
4 al.AddAnObject(al.Rectangle([1,1])),
5 al.Wait(1.0)
6)
7
8al.play_movie()
On line 3, we call al.Animate to render our animation, but where does Animate come from? On import, AnAnimLib instantiates an AnEngine object labeled engine into the AnAnimLib namespace. Then, the run method of engine is mapped to Animate. In otherwords, line 3 of the script above could be replaced by
al.engine.run(
but al.Animate looks better in the code (imho) and more clearly represents what we are actually doing. The name run refers to the fact that we are running the main loop, so it’s nice to have that reminder when we dig down to the next layer.
AnEngine
- class ananimlib.ananim.AnEngine
The central animation engine.
Contains and the central animation loop and maintains references to the Scene (the set of AnObjects currently being animated), the Camera (generates image frames the Scene), and a Backend (stores a sequence of frames from the camera)
- config_camera(width, ar, frame_rate, DPI)
Reconfigure the video settings.
- Parameters
width (float) – The width of the camera frame in Scene Units
ar (float) – The aspect ratio of a frame width/height
frame_rate (int) – The frame rate in frames per second
DPI (int) – Dots per Inch. But really, Pixels per Scene Unit
- play_movie(repeat=-1)
Have the current backend play the movie
- property render
Set to True to render frames
- run(*instructions)
Execute the instructions and render the results
This is where the main animation loop lives
- Parameters
*instructions (tuple of Instruction) – The set of instructions to run.
Simple Animation Objects (AnObjects)
Arc
- class ananimlib.Arc(radius, start_angle, stop_angle, e=0.0, pen=None)
A circular arc
- Parameters
radius (float) – Radius of curvature
start_angle (float) – The angle in radians wrt the x-axis where the arc starts
stop_angle (float) – The angle in radians wrt the x-axis where the arc stops
Arrow
- class ananimlib.Arrow(tail_pos, head_pos, head_size=1.0, pen=None, head_pen=None)
A basic arrow consisting of a line with a pointy tip.
Provides several positioning helpers.
- start, end
The start and end points of the arrow. Start is the tail, end is the head.
- Type
Vector
- pen, head_penoptional Pen
The pen used to draw the arrow
- about_head()
Position changes and rotations are about the head of the arrow.
- about_tail()
Position changes and rotations are about the tail of the arrow.
- property head_pos
Position of the head of the arrow in Scene Cooordinates.
- property tail_pos
Position of the tail of the arrow in Scene Cooordinates.
ArrowHead
- class ananimlib.ArrowHead(length=0.2, width=0.15, back=0.05, size=1.0, pen=None)
Circle
- class ananimlib.Circle(radius, e=0.0, pen=None, coordinates=None)
A Circle
- Parameters
radius (float) – The radius of hte circle
coordinates (Coordinates, optional) – An instance of a Coordinates object containing the initial position and orientation the circle.
pen (Pen) – An instance of a Pen object with rendering instructions
CrossHair
- class ananimlib.CrossHair(size=0.25, pen=None, coordinates=None)
A crosshair
Dot
- class ananimlib.Dot(radius=0.1, pen=None)
A solid dot (filled in circle)
- Parameters
radius (optional float) – The radius of the dot. default = 0.1
pen (optional Pen) – The pen used to draw the dot default = A pleasing (to me) color
DoubleArrow
- class ananimlib.DoubleArrow(tail_pos, head_pos, head_size=1.0, pen=None, head_pen=None)
Grid
Line
- class ananimlib.Line(point1, point2, pen=None)
A straight line.
- Parameters
1 (point) – The coordinates of the first end point
2 (point) – The coordinates of the second end point
Rectangle
- class ananimlib.Rectangle(size, pen=None, coordinates=None)
A rectangle.
Text AnObjects
Text
- class ananimlib.Text(text=None, pen=None, pre='', post='')
Uses Tex to render some text
TexMath
- class ananimlib.TexMath(text=None, pen=None)
Use Tex to render some math
Number
- class ananimlib.Number(number)
TextBox
- class ananimlib.TextBox(text, text_pen=None, border_pen=None)
Plotting AnObjects
CoordGrid
- class ananimlib.CoordGrid(screen_size, grid_size, major_spacing, minor_spacing=None, offset=None, major_pen=None, minor_pen=None, text_pen=None, axis_pen=None)
CoordAxis
- class ananimlib.CoordAxis(screen_size, grid_size, major_spacing=1.0, minor_spacing=0.2, label_offset=-0.2, label_orientation=0.0, origin=0)
A one dimensional coordinate axis with axis labels and tick marks.
PlotPoints
PlotMark
Base AnObject Classes
AnObject
- class ananimlib.anobject.AnObject(data, renderer, clip=None)
Base class for all Animation Objects.
The Anobject base class defines the interface for AnObjects used by the AnAnimLib animation engine.
AnObject contains the coordinate transformation information used to transform between internal data representation and external coordinates. Child classes are expected to provide a data object and rendering object.
- Parameters
data (Object) – A representation of the data to be rendered
renderer (Object) – An object with a render method that can render the data defined by the data attribute. Must have a render method: renderer.render(data,canvas)
- position
The position of the about point in external coordinates
- Type
Vector
- about_point
The position of the about point in internal coordinates
- Type
Vector
- rotation
The rotation angle between internal and external coordinates
- Type
float
- scale
The ratio of distances in the external coordinate system to distances in the internal coordinate system
- Type
Vector or float
- clip
A PolyBezier path defining a clip region.
- Type
- about_center()
Move the about point to the center of the anobject
- about_left()
Move the x-coord of the about point to the left bound.
- about_lower()
Move the y-coord of the about point to the lower bound.
- about_right()
Move the x-coord of the about point to the right bound.
- about_upper()
Move the y-coord of the about point to the upper bound.
- property bounding_box
Calculate and return coordinates of the bounding box
- Returns
bounding_box – Coordinates of the lower left and upper right corners of a box enclosing the object.
- Return type
2x3 ndarray of floats
- external2internal(coords)
Convert external coordinates to internal coordinates.
- internal2external(coords)
Convert internal coordinates to external coordinates.
- render(canvas)
Render the data object onto the requested canvas.
BezierAnObject
- class ananimlib.BezierAnObject(path=None, pen=None)
An Animation Object containing a Bezier path and a Pen to draw it.
BezierAnObject will render an arbitrary open or closed path defined by a PolyBezier curve using a BezierRender object as the renderer. BezierRender renders the path according to the attributes of Pen object.
- Parameters
path (PolyBezier) – A Poly Bezier curve representing a path to be rendered
pen (Pen) – A pen representing the appearance of the path.
- property bounding_box
Calculate and return coordinates of the bounding box
- Returns
bounding_box – Coordinates of the lower left and upper right corners of a box enclosing the object.
- Return type
2x3 ndarray of floats
ImageAnObject
- class ananimlib.ImageAnObject(filename, scale_height=None)
Animation Object containing a bitmapped image
- Parameters
filename (str) – The name of the image file
scale_height (optional, float) – The number of Scene Units that the the full height of the image should occupy. The aspect ratio of the image will be maintained. default = 1.0, meaning the image will be 1 Scene Unit tall.
- property bounding_box
Calculate and return coordinates of the bounding box
- Returns
bounding_box – Coordinates of the lower left and upper right corners of a box enclosing the object.
- Return type
2x3 ndarray of floats
- invert()
Invert the image, top to bottom
- mirror()
Flip image left to right
- render(camera)
Render the data object onto the requested canvas.
- set_scale(dpi)
Set the scale prior to rendering
CompositeAnObject
- class ananimlib.CompositeAnObject(anobjects=None, names=None)
Animation Object constructed from multiple sub-anobjects.
Allows sub-anobjects (any of which can also be a CompositeAnObject) to be grouped into a single unit. All position, scale, and rotations on the CompositeAnObject will effect all AnObjects in the composite such that their individual scales, positions, and rotations relative to one another will remain fixed.
Sub-anobjects can be manipulated through standard array indexing syntax. If a sub-anobject is a CompositeAnObject, its members can be access by passing a tuple as the index.
- add_anobject(anobject, key=None, path=None, update_transform=True)
Add an AnObject to the composite
- Parameters
anobject (AnObject) – An instance of a class derived from AnObject
name (str) – The name of the anobject for retrieval and manipulation
path (iterable) – An iterable of forward links indicating where in the Composite tree to place this AnObject.
update_transform (optional boolean) –
default = True The coordinates of a anobject (the position, scale, and rotation) are representd by an affine transformation which is applied just prior to rendering. A CompositeAnObject has its own transformation which is applied before rendering any sub-anobjects.
When update_transform is True, the new anobject’s coordinates (position, scale, and rotation) are modified by applying the inverse of the CompositeAnObject’s transformation effectively undoing it so that its final rendered position on the canvas is the same as it would have been before the call to add_anobject. This modification happens only once at the time that add_anobject is called.
When false, the added anobject’s coordinates will NOT be modified which, depending on state of the CompositeAnObject’s transformation, will could cause its rendered appearance to change.
- property bounding_box
Get the coordinates of the bounding box
- Returns
An 2x3 ndarray containing the lower left (row 1) and the
upper right (row 2) of the bounding box.
- get_anobject(key)
Get a reference to an AnObject that’s in the composite
- Parameters
key (iterable, AnObject, Slice, int, or str) – The key to the desired Anobject(s) Depends on the data type of the key: iterable - used to walk the Composite tree Anobject - uses the Anobject’s object id as a string key slice - Returns a CompositeAnObject containing a copy of the AnObjects in the slice int - used a an index into the array of AnObjects str - used as a key for internal lookup. (dictionary key)
- group(indices, name)
Place a set of anobjects into composite under a single key
- Parameters
indices (slice) – An array of the indices (ints or keys) to add to the new composite
name (string) – The key under which to store the new composite anobject
- set_attributes(attribute, value, keys=None)
Set the same attribute on each of the of selected sub-anobjects
- Parameters
attribute (string) – The name of the attribute
value – The desired attribute value
keys (optional, iterable of strings) – The keys of the anobjects whose attribute should be set. default = all contained anobjects.
SVGAnObject
Basic Instructions
AddAnObject
RemoveAnObject
Wait
MoveTo
- class ananimlib.MoveTo(key, position, duration=0.0, transfer_func=<function smooth>)
Absolute Move of a anobject to a new spot in the Scene.
- Parameters
key (dict key) – The name o
position (Vector) – The new coordinates of the anobject in Scene Units
duration (optional float) – The amount of time over which to move the anobject. default = 0.0, instantaneous
transfer_func (optional callable) – The transfer function mapping alpha to the fraction of the total distance moved default = smooth
- start(scene)
Animation sequencer calls start before the first call to update.
Move
- class ananimlib.Move(key, displacement, duration=0.0, transfer_func=<function smooth>)
Move the object the desired amount relative its current position
- Parameters
key (dict key) – The name of the anobject to move
displacement (Vector) – The new coordinates of the anobject in Scene Units
duration (optional float) – The amount of time over which to move the anobject. default = 0.0, instantaneous
transfer_func (optional callable) – The transfer function mapping alpha to the fraction of the total distance moved ratio = transfer_func(alpha) default = smooth
- start(scene)
Animation sequencer calls start before the first call to update.
Rotate
- class ananimlib.Rotate(key, angle, duration=0.0, transfer_func=<function smooth>)
Relative rotation of a anobject.
- Parameters
key (dict key) – The name of the anobject to be moved
angle (float) – The new rotation angle in radians
duration (optional float) – The amount of time over which to rotate the anobject. default = 0.0, instantaneous
Scale
- class ananimlib.Scale(key, xscale, yscale=None, duration=0.0, transfer_func=<function linear>)
Scale a anobject.
- Parameters
key (dict key) – Name of the anobject to scale
xscale (float) – x-axis scale factor
yscale (optional float) – y-axis scale factor if yscale is none, scale the same as x default = None
duration (optional float) – Duration over which to scale the anobject
AboutCenter
- class ananimlib.AboutCenter(key)
Set the about point to the center of the bounding box
- Parameters
key (dict key) – Name of the anobject to scale
AboutLeft
- class ananimlib.AboutLeft(key)
Move x coord of the about point to the left side of the bounding box
- Parameters
key (dict key) – Name of the anobject to scale
AboutRight
- class ananimlib.AboutRight(key)
Move x coord of the about point to the right side of the bounding box
- Parameters
key (dict key) – Name of the anobject to scale
AboutUpper
- class ananimlib.AboutUpper(key)
Move y coord of the about point to the top of the bounding box
- Parameters
key (dict key) – Name of the anobject to scale
AboutLower
- class ananimlib.AboutLower(key)
Move y coord of the about point to the bottom of the bounding box
- Parameters
key (dict key) – Name of the anobject to scale
AdjustAboutPoint
SetAboutPoint
- class ananimlib.SetAboutPoint(key, about_point)
Set the about point of a anobject
- Parameters
key (dict key) – Name of the anobject to scale
about_point (Vector) – The new coordinates of the about_point
Draw
- class ananimlib.Draw(key, duration=0.0)
Animate the drawing of a BezierAnObject
- Parameters
key (string) – The key to the BezierAnObject in the scene
duration (float) – The time to finish drawing
- start(scene)
Save the original data object from the anobject
- update(scene, dt)
Replace the data object with a partially drawn data object
MoveCamera
- class ananimlib.MoveCamera(position, duration=0.0)
Move the camera within the scene
- Parameters
position (array_like, float) – The position of the center of the camera frame in Scene Units
duration (float) – The amount of time over which to move the camera. default = 0.0, instantaneous
ZoomCamera
- class ananimlib.ZoomCamera(yzoom, duration=0.0, xzoom=None)
Zoom camera in or out about the center of the frame
The Zoom level is absolute and tied to Scene Units Zoom = 1 means that there is 1 Scene Unit per camera frame Zoom = 0.5 means that there are 0.5 Scene Units per camera frame
- Parameters
yzoom (float) – The zoom value for the y-axis
duration (float) – The amount of time over which to execute the zoom. default = 0.0, instantaneous
xzoom (optional float) – The zoom value fo the x-axis. If xzoom is None, it is scaled to preserve the aspect ratio default = None
- start(scene)
Over ride start to fix the aspect ratio.
Emphasize
- class ananimlib.Emphasize(key, scale_mult=2.0, duration=0.0)
Change the scale of a anobject and then return it to its original size
- Parameters
key (dict key) –
scale_mult (optional float) – The multiplier to apply to the original scale. default = 2.0
duration (float) – Number of seconds that the animation should last.
- start(scene)
Animation sequencer calls start before the first call to update.
FollowPath
- class ananimlib.FollowPath(key, path, duration, end_points=None, transfer_func=<function linear>)
Have a anobject follow a pre-defined path
- Parameters
key (dict key) – The anobject to move along the path
path (PolyBezier) – A PolyBezier curve defining the path
end_points (iterable) – The starting and ending point on the Bezier curve
duration (float) – The number of seconds the trip should take
AlignWithPath
- class ananimlib.AlignWithPath(key, path, end_points=None, duration=0.1, transfer_func=<function linear>)
Align a anobject’s rotation angle with slope of path.
- Parameters
key (dict key) – The anobject to adjust
path (PolyBezier) – A PolyBezier curve defining the path
start_point (optional, float 0.0<=start_point<=1.0) – The starting point along the path default = 0.0
end_point (optional, float) – The ending point along the path default = start_point
duration (optional float) – The number of seconds the trip should take default = 0.0
Swap
GrowArrow
DrawText
Core Instructions
RunSequential
- class ananimlib.RunSequential(*instructions)
Chains a tuple of Instrucions to execute sequentially.
- Parameters
*instruction (tuple of Instructions) – The instructions to run
RunParallel
- class ananimlib.RunParallel(*instructions)
Sets a tuple of instructions to execute in parallel.
- Parameters
*instruction (tuple of Instructions) – The instructions to run
SetAttribute
- class ananimlib.SetAttribute(key, attribute, value, anobject=None, duration=0.0, transfer_func=<function linear>)
Set an attribute of a anobject to the desired value.
If the attribute is callable, it is called with value as the parameter Otherwise, the attribute is set to value
If value is callable, it is called with the current Timing and its return value is used to set the attribute.
- eg. obj.attribute = value
obj.attribute = value(time,timing) obj.attribute(value) obj.attribute(value(time,timing))
- Parameters
key (string) –
attribute (string) –
value –
- start(scene)
Animation sequencer calls start before the first call to update.
- update(scene, dt)
Update the attribute.
- sceneScene
The scene associated with the animation
- dtfloat
The amount of time to move forward during this step
SlideAttribute
- class ananimlib.SlideAttribute(key, attribute, end_value, start_value=None, duration=0.0, relative=False, transfer_func=<function smooth>, anobject=None)
Incrementally update a numeric attribute over a fixed period of time.
- The attribute is updated as:
obj.attribute = (new_value-old_value)*transfer_function(alpha)
where alpha is the ratio of the current time used by the instruction to the requested duration
- Parameters
key (AnObject or string) – The ID of the AnObject to update
attribute (string) – The name of the attribute
end_value (type undefined) – The target value of the attribute.
start_value (optional, type undefined) – The starting value of the attribute. If start_value = None, the current value of the attribute is used. default = None
duration (optional, float) – The amount of time in seconds over which to update the attribute. default: 0.0
relative (optional, boolean) – Set to True if the end value should be relative to the current
transfer_func (callable) – A function that maps alpha to a new ratio between 0 and 1 ratio = transfer_func(alpha) default = smooth
anobject (optional AnObject) – Provide a direct reference to the object rather than a key. If anobject is None, the key is used to look the object up. If anobject is not None, the key is ignored. default = None
- start(scene)
Animation sequencer calls start before the first call to update.
Base Instruction Classes
Instruction
- class ananimlib.Instruction(next_instructions=[])
A basic node in the Instruction Tree.
Instruction contains an update function holding the code for the instruction as well as links to subsequent instructions.
- nextInstructions
The instruction(s) to execute when this instruction finishes
- Type
list of Instructions
- finished
True when the instruction has finished executing
- Type
boolean
- add_instructions(instructions)
Add an instruction to be executed when the current one finishes.
If multiple instructions are added they will run in parallel
- add_sequential(instructions)
Add a set of sequential instructions
- Parameters
instructions (list of Instruction instances) – The list of instructions to add to the tree
- start(scene)
Execute any additional setup before the first call to update.
- update(scene, dt)
Move the instruction forward dt seconds
This is where the code to control the animation goes. To build an Instruction, inherit this class and over-ride the update method.
The animation sequencer will call the update method with a reference to current Scene and a time increment (dt) representing the time to the the next animation frame.
update must return the amount of time actually used by the instruction, has a maximum of dt if the instruction has more work to do or some value less than dt if the instruction finished before dt elapsed.
- Parameters
scene (Scene instance) – The scene on which to execute the instruction
dt (float) – Time to advance the instruction in seconds
- Returns
dtUsed – The number of animation seconds that the instruction actually consumed. dtUsed will be less than dt if the instruction finished during dt elapsed
- Return type
float
InstructionTree
- class ananimlib.InstructionTree(initial_sequence=[], next_instructions=[])
Execute a set of instructions in the proper sequence.
- instructions
The instructions to execute
- Type
List of Instructions
- add_current_instructions(instructions)
Add instructions to execute on the next call to update
- Parameters
*instructions (tuple of Instructions) – The set of instructions to execute on the next call to update
- start(scene)
Send start signal to the leading instructions
- update(scene, dt)
Execute all currently active instructions
Renderers
Render
- class ananimlib.Render
Render class to pair with the data classes.
Intended as an Abstract Base Class to define the Render interface
- render(anobject, canvas)
Render the data onto the canvas.
- Parameters
data – A reperesentation of the data for render to access
canvas – The canvas on which to render the data
transform_matrix (ndarray of floats) – A nxn matrix representing an affine transformation of the data to be applied prior to rendering
CairoRender
- class ananimlib.CairoRender
Abstract base class for Cairo Render.
- parent_render(anobject, camera)
Universal Cairo rendering
Handle matrix manipulations Set the clip region call the child render
- render(data, camera)
Render the data on the cairo context contained in camera
- set_path(path, context)
Draw the path described by the bezier curve into the context
- Parameters
path (PolyBezier) – The path to set.
context (Cairo Context) – The context on which to set the path
ImageRender
CompositeRender
BezierRender
Pen
- class ananimlib.Pen(stroke_color='#FFFFFF', stroke_opacity=1.0, stroke_width=1.0, fill_color='#FFFFFF', fill_opacity=0.0, fill_pattern=None)
A container for holding stroke and fill parameters for Cairo
- stroke_color
The color of the stroke
- Type
Color
- stroke_opacity
The opacity of the stroke
- Type
float
- stroke_width
The width of the stroke
- Type
float
- fill_color
The fill color
- Type
Color
- fill_opacity
The fill opacity
- Type
float
Bezier Utilities
BezierCurve
- class ananimlib.BezierCurve(coefficients)
Container for a Cubic Bezier Curve
Holds the coeffcients of a Cubic Bezier curve defined by:
B(t) = p0*(1-t)**3 + p1*((1-t)**2)*t * p2*(1-t)*(t**2) + p3*(t**3)
- p0, p1, p2, p3
The cubic Bezier coefficients.
- Type
Vector
- B(t, deriv=0.0)
Calculate the value of the Bezier segment at t
Calculates B(t) defined as with 0<=t<=1 B(t) = p0*(1-t)**3 + p1*3*((1-t)**2)*t * p2*3*(1-t)*(t**2) + p3*(t**3)
- Parameters
t (float) – The Bezier parameter limited to 0<=t<=1
deriv (default int) – The desired derivative. default = 0.0 (no derivative)
- Returns
The coordinates of a point along the curve at t
- Return type
ndarray of floats
- D(d)
Find the point a proportional distance d along the curve.
The distance along the curve is not linear in t. The input parameter d is approximately linear with distance along the curve.
- Parameters
d (float, 0.0<=d<=1.0) – The proportional distance along the curve.
- Returns
D – The coordinates of the point a proportinal distance d along the curve
- Return type
array of floats
- T(p, param=0, niter=25)
Get the value of t the chosen coordinate.
Behavior is undefined if the curve is not singular in the chosen first coordinate.
- bounding_box()
Calculate the box (or cube in R3) that encloses the curve
Calculated by setting dB/dt = 0 and finding the roots of the resulting polynomial in each axis.
- Returns
upper_right, lower_left – Vectors indicating the upper right and lower left corners of the bounding box
- Return type
ndarray of Vectors
- property distances
Approximate distance along the curve at a discrete set of t values
- split(t)
Split the Bezier curve at t into two pieces.
Uses de Casteljau’s algorithm to divide the curve into a left and a right sub curve
- Parameters
t (float) – The split point as a fraction of the total curve. 0<=t<=1
- property t_lookup
Build a time versus proportional distance lookup table.
PolyBezier
- class ananimlib.PolyBezier(segments=None)
Container for a connected Cubic Poly-Bezier curve
Contains a set of connected Bezier Curves, where the end point of the curve at n-1 is the same as the starting point of the curve at n.
- num_segments
The number of Bezier segments
- Type
int
- B(t)
Calcuate the coordinates of the curve
- Parameters
t (float) – The Bezier parameter
- Returns
The coordinates of a point along the curve at t
- Return type
ndarray of floats
- Bdprime(t)
Calcuate the coordinates of the curve with 1<=t<=0
- Bprime(t)
Calcuate the coordinates of the curve with 1<=t<=0
- T(p, param=0, niter=25)
Get the value of t the chosen coordinate.
Behavior is undefined if the curve is not singular in the chosen first coordinate.
- add_point(t)
Add an end point at t. Creates another segment.
- add_segment(segment)
Add a Bezeir Segement to the curve
- Parameters
segment (BezierSegment) – The Bezier Segment to add to the curve
- property bounding_box
Calculate and return coordinates of the bounding box
- Returns
bounding_box – Coordinates of the lower left and upper right corners of a box whose sides either coincide with the curve’s endpoints or are tangent to the curve’s extremities on each axis.
- Return type
2x3 ndarray of floats
- calc_bounding_box()
Calculate the coordinates of the Bezier Curve bounding box
- Returns
bounding_box – Coordinates of the lower left and upper right corners of a box whose sides either coincide with the curve’s endpoints or are tangent to the curve’s extremities on each axis.
- Return type
2x3 ndarray of floats
- connect_linear(data, close=False)
Connect a set of points in 3-space with straight lines
Adds the curve to the current set of points
- Parameters
data (nx3 iterable of floats) – The n data points to connect
close (optional Boolean) – Connect last point back to the first when True default = False
- connect_smooth(data)
Smoothly connect a set of points in 3-space with Cubic Bezier segs
Adds the curve to the current set of points
Apologies for the barely readable numpy code below. At some point it should be reworked into an intelligible form.
- Parameters
data (nx3 iterable of floats) – A set of n triplets representing 3-space coordinates to be connected.
- find_segment(t)
Find the index and t for a segment given t for the polycurve
- Parameters
t (float) – T
- property lengths
The length of each segment
- property points
Return the Bezier coefficients as an n*4x3 ndarray
- shift(displacement)
Shift the curve’s position by the desired displacement.
Adds the displacement vector to all of the points defining the curve
- Parameters
displacement (Vector) – The displacement vector to add to the points
- split(t)
Split the Bezier curve at t into two pieces.
Let 0<=t<=1 so that it represents a portion of the entire shape. split finds locates the correct BezierSegment and divides it using BezierSegment.split
- Parameters
t (float) – The split point as a fraction of the total curve. 0<=t<=1