Package org.gnome.graphene
Class Plane
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.graphene.Plane
- All Implemented Interfaces:
Proxy
A 2D plane that extends infinitely in a 3D volume.
The contents of the graphene_plane_t are private, and should not be
modified directly.
- Since:
- 1.2
-
Constructor Summary
ConstructorsConstructorDescriptionPlane()Allocate a new Plane.Allocate a new Plane.Plane(MemorySegment address) Create a Plane proxy instance for the provided memory address.Allocate a new Plane with the fields set to the provided values.Allocate a new Plane with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic Planealloc()Allocates a newgraphene_plane_tstructure.floatComputes the distance ofpointfrom agraphene_plane_t.booleanChecks whether the two givengraphene_plane_tare equal.voidfree()Frees the resources allocated by graphene_plane_alloc().floatRetrieves the distance along the normal vector of the givengraphene_plane_tfrom the origin.static MemoryLayoutThe memory layout of the native struct.voidRetrieves the normal vector pointing towards the origin of the givengraphene_plane_t.static @Nullable TypegetType()Get the GType of the Plane classInitializes the givengraphene_plane_tusing the givennormalvector andconstantvalues.initFromPlane(Plane src) Initializes the givengraphene_plane_tusing the normal vector and constant of anothergraphene_plane_t.initFromPoint(Vec3 normal, Point3D point) Initializes the givengraphene_plane_tusing the given normal vector and an arbitrary co-planar point.initFromPoints(Point3D a, Point3D b, Point3D c) Initializes the givengraphene_plane_tusing the 3 provided co-planar points.initFromVec4(Vec4 src) Initializes the givengraphene_plane_tusing the components of the givengraphene_vec4_tvector.voidNegates the normal vector and constant of agraphene_plane_t, effectively mirroring the plane across the origin.voidNormalizes the vector of the givengraphene_plane_t, and adjusts the constant accordingly.floatRead the value of the fieldconstant.@Nullable Vec3Read the value of the fieldnormal.voidTransforms agraphene_plane_tthis Plane using the givenmatrixandnormalMatrix.voidwriteConstant(float constant) Write a value in the fieldconstant.voidwriteNormal(@Nullable Vec3 normal) Write a value in the fieldnormal.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Plane
Create a Plane proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Plane
Allocate a new Plane.- Parameters:
arena- to control the memory allocation scope
-
Plane
public Plane()Allocate a new Plane. The memory is allocated withArena.ofAuto(). -
Plane
-
Plane
Allocate a new Plane with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
normal- value for the fieldnormalconstant- value for the fieldconstant
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readNormal
Read the value of the fieldnormal.- Returns:
- The value of the field
normal
-
writeNormal
Write a value in the fieldnormal.- Parameters:
normal- The new value for the fieldnormal
-
readConstant
public float readConstant()Read the value of the fieldconstant.- Returns:
- The value of the field
constant
-
writeConstant
public void writeConstant(float constant) Write a value in the fieldconstant.- Parameters:
constant- The new value for the fieldconstant
-
alloc
Allocates a newgraphene_plane_tstructure.The contents of the returned structure are undefined.
- Returns:
- the newly allocated
graphene_plane_t. Use graphene_plane_free() to free the resources allocated by this function - Since:
- 1.2
-
distance
Computes the distance ofpointfrom agraphene_plane_t.- Parameters:
point- agraphene_point3d_t- Returns:
- the distance of the given
graphene_point3d_tfrom the plane - Since:
- 1.2
-
equal
Checks whether the two givengraphene_plane_tare equal.- Parameters:
b- agraphene_plane_t- Returns:
trueif the given planes are equal- Since:
- 1.2
-
free
public void free()Frees the resources allocated by graphene_plane_alloc().- Since:
- 1.2
-
getConstant
public float getConstant()Retrieves the distance along the normal vector of the givengraphene_plane_tfrom the origin.- Returns:
- the constant value of the plane
- Since:
- 1.2
-
getNormal
Retrieves the normal vector pointing towards the origin of the givengraphene_plane_t.- Parameters:
normal- return location for the normal vector- Since:
- 1.2
-
init
Initializes the givengraphene_plane_tusing the givennormalvector andconstantvalues.- Parameters:
normal- a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by defaultconstant- the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane- Returns:
- the initialized plane
- Since:
- 1.2
-
initFromPlane
-
initFromPoint
Initializes the givengraphene_plane_tusing the given normal vector and an arbitrary co-planar point.- Parameters:
normal- a normal vector defining the plane pointing towards the originpoint- agraphene_point3d_t- Returns:
- the initialized plane
- Since:
- 1.2
-
initFromPoints
Initializes the givengraphene_plane_tusing the 3 provided co-planar points.The winding order is counter-clockwise, and determines which direction the normal vector will point.
- Parameters:
a- agraphene_point3d_tb- agraphene_point3d_tc- agraphene_point3d_t- Returns:
- the initialized plane
- Since:
- 1.2
-
initFromVec4
Initializes the givengraphene_plane_tusing the components of the givengraphene_vec4_tvector.- Parameters:
src- agraphene_vec4_tcontaining the normal vector in its first three components, and the distance in its fourth component- Returns:
- the initialized plane
- Since:
- 1.2
-
negate
Negates the normal vector and constant of agraphene_plane_t, effectively mirroring the plane across the origin.- Parameters:
res- return location for the negated plane- Since:
- 1.2
-
normalize
Normalizes the vector of the givengraphene_plane_t, and adjusts the constant accordingly.- Parameters:
res- return location for the normalized plane- Since:
- 1.2
-
transform
Transforms agraphene_plane_tthis Plane using the givenmatrixandnormalMatrix.If
normalMatrixisnull, a transformation matrix for the plane normal will be computed frommatrix.If you are transforming multiple planes using the samematrixit's recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time.- Parameters:
matrix- agraphene_matrix_tnormalMatrix- agraphene_matrix_tres- the transformed plane- Since:
- 1.10
-