Record Class QuadraticBezier
java.lang.Object
java.lang.Record
top.girlkisser.lazuli.api.mathematics.QuadraticBezier
- Record Components:
start- The starting position.control- The control point.end- The ending position.
public record QuadraticBezier(org.joml.Vector2f start, org.joml.Vector2f control, org.joml.Vector2f end)
extends Record
A quadratic Bézier curve implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<QuadraticBezier> A codec for a quadratic Bézier curve with the following format:
{ "start": { "x": 0.0, "y": 0.0 }, "control": { "x": 0.25, "y": 0.5 }, "end": { "x": 1.0, "y": 1.0 } }static final com.mojang.serialization.Codec<QuadraticBezier> A codec for a quadratic Bézier curve with the following format:
[ { "x": 0.0, "y": 0.0 }, { "x": 0.5, "y": 0.5 }, { "x": 1.0, "y": 1.0 } ]static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, QuadraticBezier> static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, QuadraticBezier> -
Constructor Summary
ConstructorsConstructorDescriptionQuadraticBezier(float controlX, float controlY) Create a quadratic Bézier curve using the provided coordinates for the control point.QuadraticBezier(float startX, float startY, float controlX, float controlY, float endX, float endY) Create a quadratic Bézier curve using the provided coordinates for points.QuadraticBezier(org.joml.Vector2f control) Create a quadratic Bézier curve using the provided control point.QuadraticBezier(org.joml.Vector2f start, org.joml.Vector2f control, org.joml.Vector2f end) Creates an instance of aQuadraticBezierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector2fcontrol()Returns the value of thecontrolrecord 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 quadratic Bézier curve with the following format:
{ "start": { "x": 0.0, "y": 0.0 }, "control": { "x": 0.25, "y": 0.5 }, "end": { "x": 1.0, "y": 1.0 } } -
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,QuadraticBezier> STREAM_CODEC -
LIST_CODEC
A codec for a quadratic Bézier curve with the following format:
[ { "x": 0.0, "y": 0.0 }, { "x": 0.5, "y": 0.5 }, { "x": 1.0, "y": 1.0 } ] -
LIST_STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,QuadraticBezier> LIST_STREAM_CODEC
-
-
Constructor Details
-
QuadraticBezier
public QuadraticBezier(org.joml.Vector2f control) Create a quadratic Bézier curve using the provided control point. The start and end points are 0,0 and 1,1 respectively.- Parameters:
control- The control point.
-
QuadraticBezier
public QuadraticBezier(float controlX, float controlY) Create a quadratic Bézier curve using the provided coordinates for the control point.- Parameters:
controlX- The control point's X coordinate.controlY- The control point's Y coordinate.
-
QuadraticBezier
public QuadraticBezier(float startX, float startY, float controlX, float controlY, float endX, float endY) Create a quadratic Bézier curve using the provided coordinates for points.- Parameters:
startX- The start point's X coordinate.startY- The start point's Y coordinate.controlX- The control point's X coordinate.controlY- The control point's Y coordinate.endX- The end point's X coordinate.endY- The end point's Y coordinate.
-
QuadraticBezier
public QuadraticBezier(org.joml.Vector2f start, org.joml.Vector2f control, org.joml.Vector2f end) Creates an instance of aQuadraticBezierrecord 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
-
control
public org.joml.Vector2f control()Returns the value of thecontrolrecord component.- Returns:
- the value of the
controlrecord component
-
end
public org.joml.Vector2f end()Returns the value of theendrecord component.- Returns:
- the value of the
endrecord component
-