LatheShape class final
A surface of revolution: a profile polyline swept around the Y axis.
This is the generator the rounded primitives are built from, which is why it is a class rather than a function — SphereShape, CylinderShape, TorusShape and friends hold one of these and expose friendlier parameters.
profile lives in the (radius, height) half-plane: x is the distance from
the Y axis and must be >= 0, y is the position along it.
Orientation follows the profile direction, consistently for both normals and winding: a profile ordered bottom-to-top yields outward normals and counter-clockwise front faces. Reverse the profile to get an inside-out surface (useful for skyboxes) without touching any other flag.
Normals are derived analytically from the profile tangent rather than by averaging face normals, which keeps cones and poles exact. Repeating a profile point produces a hard edge: the duplicated pair has a zero-length delta on one side, so each copy falls back to its own one-sided tangent. That is how CylinderShape gets crisp rims where the caps meet the wall.
UVs use u = angle / sweepAngle and v = normalized arc length along the
profile. Arc length, rather than point index, keeps texels from bunching up
where the profile is finely subdivided.
Derived normals come from chords, which is exact for straight profile segments but first-order wrong at the ends of a curved profile: at a sphere pole built from 16 rings the error is about 5.6 degrees. Pass profileNormals when the profile has a known analytic normal, as SphereShape and CapsuleShape do.
Constructors
Properties
- closedProfile → bool
-
Whether the profile's last point connects back to its first.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Name for diagnostics and UI labels.
final
-
profile
→ List<
Vector2> -
final
-
profileNormals
→ List<
Vector2> ? -
Optional exact normals, one
(radial, axial)vector per profile point.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- segments → int
-
final
- startAngle → double
-
final
- sweepAngle → double
-
final
Methods
-
build(
{VertexLayout layout = VertexLayout.standard}) → MeshData -
Generates the geometry for the requested
layout.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited