Arrow3D¶
Qualified name: algan.mobs.shapes\_3d.Arrow3D
- class Arrow3D(start=tensor([-1., -0., -0.]), end=tensor([1., 0., 0.]), shaft_radius=0.02, tip_length=0.3, tip_radius=0.08, color=Color([1., 1., 1., 0., 1.]), resolution=24, *args, **kwargs)[source]¶
Bases:
MobAn arrow: a
Cylindershaft with aConetip, grouped.Both parts are curved surfaces, so the arrow is tessellated per frame like the rest of the curved family.
- Parameters:
start – Tail and head of the arrow, shape
(*, 3)in world units. Default toLEFTandRIGHT.end – Tail and head of the arrow, shape
(*, 3)in world units. Default toLEFTandRIGHT.shaft_radius (float) – Radius of the shaft, in world units. Defaults to
0.02.tip_length (float) – Length of the conical tip, in world units, measured back from
end. Defaults to0.3.tip_radius (float) – Radius of the tip’s base, in world units. Defaults to
0.08.color – An Algan
Color, a named constant such asBLUE, or anythingColor()accepts. Defaults toWHITE.resolution – Grid resolution for both parts, as
(grid_width, grid_height)or one int for both. Defaults to24.*args – Passed to
Mob.**kwargs – Passed to
Mob.
- Raises:
ValueError – If the distance from
starttoendis not greater thantip_length, which would leave no room for a shaft.
Examples
An arrow pointing up and to the right:
Example: Example1Arrow3D ¶
from algan import * Arrow3D(start=LEFT + DOWN, end=RIGHT + UP, shaft_radius=0.04, color=BLUE).spawn() Scene.save_video()
Methods
get_endget_render_primitivesget_startget_unit_vectorget_vectorAttributes
animation_managerThis mob's scene-owned animation manager.
basisThe Mob's orientation and scale, as a flattened 3x3 matrix of shape
(*, 9).casts_shadowsWhether this Mob's geometry blocks light on its way from a light source to another surface -- whether it casts a shadow.
childrenThe Mobs attached below this one, in attachment order.
closed_shellWhether this Mob's triangles form a CLOSED shell -- every camera ray that enters the geometry crosses a second time on its way out.
Whether
get_render_primitivesreturns geometry belonging to this Mob's DESCENDANTS as well as its own.forwardGet the direction the Mob is facing.
lifespanThis mob's [spawn, despawn) interval on its Scene timeline (a
Lifespan).locationThe Mob's position in world space, shape
(*, 3).normalized_basisThe Mob's orientation with scale divided out, shape
(*, 9).parentsThe Mobs this one is attached to, in attachment order.
receives_shadowsWhether this Mob's surfaces are darkened by shadows cast onto them.
rightGet the Mob's own rightward direction.
scale_coefficientThe Mob's scale along its own right, up and forward axes, shape
(*, 3).two_sidedWhether this Mob's geometry should be lit from whichever side the ray arrives on.
upGet the Mob's own upward direction.
xThe Mob's x coordinate in world units, shape
(*, 1).xyThe Mob's x and y coordinates in world units, shape
(*, 2).yThe Mob's y coordinate in world units, shape
(*, 1).zThe Mob's z coordinate in world units, shape
(*, 1).- draws_descendants = True¶
Whether
get_render_primitivesreturns geometry belonging to this Mob’s DESCENDANTS as well as its own. Almost nothing does: aBezierCircuitCubicor aSurfacedraws its own rows and leaves its children to draw themselves.Polyhedronis the exception – it gathers every face under one_mesh_key– and the difference decides two things forbecome(): whether the Mob is one morph unit or several, and whether a descendant may be published to the Scene in its own right (doing so under an aggregator draws it twice, and draws geometry the aggregator deliberately omits, such as a Polyhedron’s vertex-and-edge graph).