Class BezierPath
java.lang.Object
de.luckymcdev.foundryengine.common.easing.BezierPath
Represents a complete Bézier path composed of multiple splines.
Provides arc-length parameterization for constant-speed motion.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBezierPath(net.minecraft.nbt.ListTag list) Creates a BezierPath from serialized NBT data.BezierPath(net.minecraft.world.phys.Vec3 startPos) -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of non-tangent ("node") points in this path.Returns all non-tangent ("node") points in order from start to end.doublegetDistanceAtTime(double time) Returns the approximate arc-length distance (in blocks) along the path at the given time parameter (0..1) oflerp(double).doublegetNormalizedDistanceAtTime(double time) Returns the normalized arc-length distance (0..1) along the path at the given time parameter (0..1) oflerp(double).Gets all control points in the path.doubleGets the total arc length of the path.voidInvalidates the LUT cache, forcing recalculation on next use.booleanisPointFirstOrLast(BezierPoint point) Checks if a point is at the start or end of the path.booleannet.minecraft.world.phys.Vec3lerpSpeedWeighted(double t) Interpolates a position using arc-length parameterization.voidremovePoint(BezierPoint point) Removes a point and its associated spline(s).net.minecraft.nbt.ListTagtoNbt()Serializes the path to NBT format.voidUpdates the Look-Up Table (LUT) for arc-length parameterization.withPlayerEnd(net.minecraft.world.entity.player.Player player) withPlayerOrigin(net.minecraft.world.entity.player.Player player)
-
Field Details
-
splines
-
-
Constructor Details
-
BezierPath
public BezierPath(net.minecraft.world.phys.Vec3 startPos) -
BezierPath
public BezierPath(net.minecraft.nbt.ListTag list) Creates a BezierPath from serialized NBT data.
-
-
Method Details
-
isSinglePoint
public boolean isSinglePoint() -
withPlayerOrigin
-
withPlayerEnd
-
updateLUT
public void updateLUT()Updates the Look-Up Table (LUT) for arc-length parameterization. This should be called whenever any point on the path changes. -
getDistanceAtTime
public double getDistanceAtTime(double time) Returns the approximate arc-length distance (in blocks) along the path at the given time parameter (0..1) oflerp(double). This is derived from the same LUT used for constant-speed motion. -
getNormalizedDistanceAtTime
public double getNormalizedDistanceAtTime(double time) Returns the normalized arc-length distance (0..1) along the path at the given time parameter (0..1) oflerp(double). -
lerpSpeedWeighted
public net.minecraft.world.phys.Vec3 lerpSpeedWeighted(double t) Interpolates a position using arc-length parameterization. This provides constant-speed motion along the path.- Parameters:
t- parameter from 0 to 1 representing distance along the path
-
getPoints
Gets all control points in the path. -
getAnchorPoints
Returns all non-tangent ("node") points in order from start to end. -
getAnchorPointCount
public int getAnchorPointCount()Returns the number of non-tangent ("node") points in this path. -
removePoint
Removes a point and its associated spline(s). -
isPointFirstOrLast
Checks if a point is at the start or end of the path. -
toNbt
public net.minecraft.nbt.ListTag toNbt()Serializes the path to NBT format. -
getTotalLength
public double getTotalLength()Gets the total arc length of the path. -
invalidateLUT
public void invalidateLUT()Invalidates the LUT cache, forcing recalculation on next use.
-