Class BezierPath

java.lang.Object
de.luckymcdev.foundryengine.common.easing.BezierPath

public class BezierPath extends Object
Represents a complete Bézier path composed of multiple splines. Provides arc-length parameterization for constant-speed motion.
  • Field Details

  • 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

      public BezierPath withPlayerOrigin(net.minecraft.world.entity.player.Player player)
    • withPlayerEnd

      public BezierPath withPlayerEnd(net.minecraft.world.entity.player.Player player)
    • 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) of lerp(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) of lerp(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

      public ArrayList<BezierPoint> getPoints()
      Gets all control points in the path.
    • getAnchorPoints

      public ArrayList<BezierPoint> 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

      public void removePoint(BezierPoint point)
      Removes a point and its associated spline(s).
    • isPointFirstOrLast

      public boolean isPointFirstOrLast(BezierPoint point)
      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.