Record Class CubicBezier
java.lang.Object
java.lang.Record
top.girlkisser.lazuli.api.mathematics.CubicBezier
- Record Components:
start- The starting position.control1- The first control point.control2- The second control point.end- The ending position.
public record CubicBezier(org.joml.Vector2f start, org.joml.Vector2f control1, org.joml.Vector2f control2, org.joml.Vector2f end)
extends Record
A cubic Bézier curve implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<CubicBezier> A codec for a cubic Bézier curve with the following format:
{ "start": { "x": 0.0, "y": 0.0 }, "control1": { "x": 0.25, "y": 0.5 }, "control2": { "x": 0.75, "y": 0.2 }, "end": { "x": 1.0, "y": 1.0 } }static final com.mojang.serialization.Codec<CubicBezier> A codec for a cubic Bézier curve with the following format:
[ { "x": 0.0, "y": 0.0 }, { "x": 0.25, "y": 0.5 }, { "x": 0.75, "y": 0.2 }, { "x": 1.0, "y": 1.0 } ]static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, CubicBezier> static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, CubicBezier> -
Constructor Summary
ConstructorsConstructorDescriptionCubicBezier(float control1X, float control1Y, float control2X, float control2Y) Create a cubic Bézier curve using the provided coordinates for control points.CubicBezier(float startX, float startY, float control1X, float control1Y, float control2X, float control2Y, float endX, float endY) Create a cubic Bézier curve using the provided coordinates for points.CubicBezier(org.joml.Vector2f control1, org.joml.Vector2f control2) Create a cubic Bézier curve using the provided control points.CubicBezier(org.joml.Vector2f start, org.joml.Vector2f control1, org.joml.Vector2f control2, org.joml.Vector2f end) Creates an instance of aCubicBezierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector2fcontrol1()Returns the value of thecontrol1record component.org.joml.Vector2fcontrol2()Returns the value of thecontrol2record component.org.joml.Vector2fend()Returns the value of theendrecord component.final booleanIndicates whether some other object is "equal to" this one.List<org.joml.Vector2f> getPoints(float resolution) Get a list of points from 0 to 1 with `resolution` steps.final inthashCode()Returns a hash code value for this object.org.joml.Vector2fsample(float t) Get the point for the given `t` value.org.joml.Vector2fstart()Returns the value of thestartrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
A codec for a cubic Bézier curve with the following format:
{ "start": { "x": 0.0, "y": 0.0 }, "control1": { "x": 0.25, "y": 0.5 }, "control2": { "x": 0.75, "y": 0.2 }, "end": { "x": 1.0, "y": 1.0 } } -
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,CubicBezier> STREAM_CODEC -
LIST_CODEC
A codec for a cubic Bézier curve with the following format:
[ { "x": 0.0, "y": 0.0 }, { "x": 0.25, "y": 0.5 }, { "x": 0.75, "y": 0.2 }, { "x": 1.0, "y": 1.0 } ] -
LIST_STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,CubicBezier> LIST_STREAM_CODEC
-
-
Constructor Details
-
CubicBezier
public CubicBezier(org.joml.Vector2f control1, org.joml.Vector2f control2) Create a cubic Bézier curve using the provided control points. The start and end points are 0,0 and 1,1 respectively.- Parameters:
control1- The first control point.control2- The second control point.
-
CubicBezier
public CubicBezier(float control1X, float control1Y, float control2X, float control2Y) Create a cubic Bézier curve using the provided coordinates for control points. The start and end points are 0,0 and 1,1 respectively.- Parameters:
control1X- The first control point's X coordinate.control1Y- The first control point's Y coordinate.control2X- The second control point's X coordinate.control2Y- The second control point's Y coordinate.
-
CubicBezier
public CubicBezier(float startX, float startY, float control1X, float control1Y, float control2X, float control2Y, float endX, float endY) Create a cubic Bézier curve using the provided coordinates for points.- Parameters:
startX- The start point's X coordinate.startY- The start point's Y coordinate.control1X- The first control point's X coordinate.control1Y- The first control point's Y coordinate.control2X- The second control point's X coordinate.control2Y- The second control point's Y coordinate.endX- The end point's X coordinate.endY- The end point's Y coordinate.
-
CubicBezier
public CubicBezier(org.joml.Vector2f start, org.joml.Vector2f control1, org.joml.Vector2f control2, org.joml.Vector2f end) Creates an instance of aCubicBezierrecord class.
-
-
Method Details
-
sample
public org.joml.Vector2f sample(float t) Get the point for the given `t` value.- Parameters:
t- The "progress" of the curve, from 0 to 1.- Returns:
- The point at the given `t` value.
-
getPoints
Get a list of points from 0 to 1 with `resolution` steps.- Parameters:
resolution- The amount of steps, or "resolution" of the points.- Returns:
- The list of points.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
start
public org.joml.Vector2f start()Returns the value of thestartrecord component.- Returns:
- the value of the
startrecord component
-
control1
public org.joml.Vector2f control1()Returns the value of thecontrol1record component.- Returns:
- the value of the
control1record component
-
control2
public org.joml.Vector2f control2()Returns the value of thecontrol2record component.- Returns:
- the value of the
control2record component
-
end
public org.joml.Vector2f end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-