Package org.gnome.graphene
Class Sphere
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.graphene.Sphere
-
Constructor Summary
ConstructorDescriptionSphere()
Allocate a new Sphere.Allocate a new Sphere.Sphere
(MemorySegment address) Create a Sphere proxy instance for the provided memory address.Allocate a new Sphere with the fields set to the provided values.Allocate a new Sphere with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic Sphere
alloc()
Allocates a newgraphene_sphere_t
.boolean
containsPoint
(Point3D point) Checks whether the givenpoint
is contained in the volume of agraphene_sphere_t
.float
Computes the distance of the givenpoint
from the surface of agraphene_sphere_t
.boolean
Checks whether twographene_sphere_t
are equal.void
free()
Frees the resources allocated by graphene_sphere_alloc().void
getBoundingBox
(Box box) Computes the bounding box capable of containing the givengraphene_sphere_t
.void
Retrieves the coordinates of the center of agraphene_sphere_t
.static MemoryLayout
The memory layout of the native struct.float
Retrieves the radius of agraphene_sphere_t
.static Type
getType()
Get the GType of the Sphere classInitializes the givengraphene_sphere_t
with the givencenter
andradius
.initFromPoints
(Point3D[] points, @Nullable Point3D center) Initializes the givengraphene_sphere_t
using the given array of 3D coordinates so that the sphere includes them.initFromVectors
(Vec3[] vectors, @Nullable Point3D center) Initializes the givengraphene_sphere_t
using the given array of 3D coordinates so that the sphere includes them.boolean
isEmpty()
Checks whether the sphere has a zero radius.Read the value of the fieldcenter
.float
Read the value of the fieldradius
.void
Translates the center of the givengraphene_sphere_t
using thepoint
coordinates as the delta of the translation.void
writeCenter
(Vec3 center) Write a value in the fieldcenter
.void
writeRadius
(float radius) Write a value in the fieldradius
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Sphere
Create a Sphere proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Sphere
Allocate a new Sphere.- Parameters:
arena
- to control the memory allocation scope
-
Sphere
public Sphere()Allocate a new Sphere. The memory is allocated withArena.ofAuto()
. -
Sphere
-
Sphere
Allocate a new Sphere with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
center
- value for the fieldcenter
radius
- value for the fieldradius
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readCenter
-
writeCenter
Write a value in the fieldcenter
.- Parameters:
center
- The new value for the fieldcenter
-
readRadius
public float readRadius()Read the value of the fieldradius
.- Returns:
- The value of the field
radius
-
writeRadius
public void writeRadius(float radius) Write a value in the fieldradius
.- Parameters:
radius
- The new value for the fieldradius
-
alloc
Allocates a newgraphene_sphere_t
.The contents of the newly allocated structure are undefined.
- Returns:
- the newly allocated
graphene_sphere_t
. Use graphene_sphere_free() to free the resources allocated by this function
-
containsPoint
Checks whether the givenpoint
is contained in the volume of agraphene_sphere_t
.- Parameters:
point
- agraphene_point3d_t
- Returns:
true
if the sphere contains the point
-
distance
Computes the distance of the givenpoint
from the surface of agraphene_sphere_t
.- Parameters:
point
- agraphene_point3d_t
- Returns:
- the distance of the point
-
equal
Checks whether twographene_sphere_t
are equal.- Parameters:
b
- agraphene_sphere_t
- Returns:
true
if the spheres are equal
-
free
public void free()Frees the resources allocated by graphene_sphere_alloc(). -
getBoundingBox
Computes the bounding box capable of containing the givengraphene_sphere_t
.- Parameters:
box
- return location for the bounding box
-
getCenter
Retrieves the coordinates of the center of agraphene_sphere_t
.- Parameters:
center
- return location for the coordinates of the center
-
getRadius
public float getRadius()Retrieves the radius of agraphene_sphere_t
. -
init
Initializes the givengraphene_sphere_t
with the givencenter
andradius
.- Parameters:
center
- the coordinates of the center of the sphere, ornull
for a center in (0, 0, 0)radius
- the radius of the sphere- Returns:
- the initialized
graphene_sphere_t
-
initFromPoints
Initializes the givengraphene_sphere_t
using the given array of 3D coordinates so that the sphere includes them.The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all
points
.- Parameters:
points
- an array ofgraphene_point3d_t
center
- the center of the sphere- Returns:
- the initialized
graphene_sphere_t
-
initFromVectors
Initializes the givengraphene_sphere_t
using the given array of 3D coordinates so that the sphere includes them.The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all
vectors
.- Parameters:
vectors
- an array ofgraphene_vec3_t
center
- the center of the sphere- Returns:
- the initialized
graphene_sphere_t
-
isEmpty
public boolean isEmpty()Checks whether the sphere has a zero radius.- Returns:
true
if the sphere is empty
-
translate
-