Package forgottentowns.mod.api
Record Class ParticleShape
java.lang.Object
java.lang.Record
forgottentowns.mod.api.ParticleShape
- Record Components:
vertices- counterclockwise polygon vertices around the origin, between three and sixteen
Convex particle silhouette, reused by ordinary and body-masked drawing.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionParticleShape(List<ParticleShape.Point> vertices) Copies and validates a convex polygon containing the origin. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(double x, double y) Tests the same silhouette used by the renderer's clipping path.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.vertices()Returns the value of theverticesrecord component.
-
Constructor Details
-
ParticleShape
Copies and validates a convex polygon containing the origin.- Parameters:
vertices- counterclockwise normalized vertices- Throws:
IllegalArgumentException- if vertices is null, contains null, has fewer than three or more than sixteen entries, fails counterclockwise origin containment, or is nonconvex
-
-
Method Details
-
contains
public boolean contains(double x, double y) Tests the same silhouette used by the renderer's clipping path.- Parameters:
x- finite normalized horizontal query coordinatey- finite normalized vertical query coordinate- Returns:
- true when no edge places the point strictly outside, including polygon boundaries; nonfinite inputs are not validated and must not be supplied
-
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). -
vertices
Returns the value of theverticesrecord component.- Returns:
- the value of the
verticesrecord component
-