Package org.gnome.graphene
Class Sphere
java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.graphene.Sphere
-
Constructor Summary
ConstructorsConstructorDescriptionSphere()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 Spherealloc()Allocates a newgraphene_sphere_t.booleancontainsPoint(Point3D point) Checks whether the givenpointis contained in the volume of agraphene_sphere_t.floatComputes the distance of the givenpointfrom the surface of agraphene_sphere_t.booleanChecks whether twographene_sphere_tare equal.voidfree()Frees the resources allocated by graphene_sphere_alloc().voidgetBoundingBox(Box box) Computes the bounding box capable of containing the givengraphene_sphere_t.voidRetrieves the coordinates of the center of agraphene_sphere_t.static MemoryLayoutThe memory layout of the native struct.floatRetrieves the radius of agraphene_sphere_t.static @Nullable TypegetType()Get the GType of the Sphere classInitializes the givengraphene_sphere_twith the givencenterandradius.initFromPoints(@Nullable Point3D @Nullable [] points, @Nullable Point3D center) Initializes the givengraphene_sphere_tusing the given array of 3D coordinates so that the sphere includes them.initFromVectors(@Nullable Vec3 @Nullable [] vectors, @Nullable Point3D center) Initializes the givengraphene_sphere_tusing the given array of 3D coordinates so that the sphere includes them.booleanisEmpty()Checks whether the sphere has a zero radius.@Nullable Vec3Read the value of the fieldcenter.floatRead the value of the fieldradius.voidTranslates the center of the givengraphene_sphere_tusing thepointcoordinates as the delta of the translation.voidwriteCenter(@Nullable Vec3 center) Write a value in the fieldcenter.voidwriteRadius(float radius) Write a value in the fieldradius.Methods inherited from class org.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 fieldcenterradius- value for the fieldradius
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readCenter
Read the value of the fieldcenter.- Returns:
- The value of the field
center
-
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 - Since:
- 1.2
-
containsPoint
Checks whether the givenpointis contained in the volume of agraphene_sphere_t.- Parameters:
point- agraphene_point3d_t- Returns:
trueif the sphere contains the point- Since:
- 1.2
-
distance
Computes the distance of the givenpointfrom the surface of agraphene_sphere_t.- Parameters:
point- agraphene_point3d_t- Returns:
- the distance of the point
- Since:
- 1.2
-
equal
Checks whether twographene_sphere_tare equal.- Parameters:
b- agraphene_sphere_t- Returns:
trueif the spheres are equal- Since:
- 1.2
-
free
public void free()Frees the resources allocated by graphene_sphere_alloc().- Since:
- 1.2
-
getBoundingBox
Computes the bounding box capable of containing the givengraphene_sphere_t.- Parameters:
box- return location for the bounding box- Since:
- 1.2
-
getCenter
Retrieves the coordinates of the center of agraphene_sphere_t.- Parameters:
center- return location for the coordinates of the center- Since:
- 1.2
-
getRadius
public float getRadius()Retrieves the radius of agraphene_sphere_t.- Since:
- 1.2
-
init
Initializes the givengraphene_sphere_twith the givencenterandradius.- Parameters:
center- the coordinates of the center of the sphere, ornullfor a center in (0, 0, 0)radius- the radius of the sphere- Returns:
- the initialized
graphene_sphere_t - Since:
- 1.2
-
initFromPoints
Initializes the givengraphene_sphere_tusing 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_tcenter- the center of the sphere- Returns:
- the initialized
graphene_sphere_t - Since:
- 1.2
-
initFromVectors
Initializes the givengraphene_sphere_tusing 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_tcenter- the center of the sphere- Returns:
- the initialized
graphene_sphere_t - Since:
- 1.2
-
isEmpty
public boolean isEmpty()Checks whether the sphere has a zero radius.- Returns:
trueif the sphere is empty- Since:
- 1.2
-
translate
-