Class Box
- All Implemented Interfaces:
Proxy
- Since:
- 1.2
-
Constructor Summary
ConstructorsConstructorDescriptionBox()Allocate a new Box.Allocate a new Box.Box(MemorySegment address) Create a Box proxy instance for the provided memory address.Allocate a new Box with the fields set to the provided values.Allocate a new Box with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic Boxalloc()Allocates a newgraphene_box_t.booleancontainsBox(Box b) Checks whether thegraphene_box_tthis Box contains the givengraphene_box_tb.booleancontainsPoint(Point3D point) Checks whether this Box contains the givenpoint.static Boxempty()A degenerategraphene_box_tthat can only be expanded.booleanChecks whether the two given boxes are equal.voidExpands the dimensions of this Box to include the coordinates atpoint.voidexpandScalar(float scalar, Box res) Expands the dimensions of this Box by the givenscalarvalue.voidexpandVec3(Vec3 vec, Box res) Expands the dimensions of this Box to include the coordinates of the given vector.voidfree()Frees the resources allocated by graphene_box_alloc().voidgetBoundingSphere(Sphere sphere) Computes the boundinggraphene_sphere_tcapable of containing the givengraphene_box_t.voidRetrieves the coordinates of the center of agraphene_box_t.floatgetDepth()Retrieves the size of the this Box on the Z axis.floatRetrieves the size of the this Box on the Y axis.voidRetrieves the coordinates of the maximum point of the givengraphene_box_t.static MemoryLayoutThe memory layout of the native struct.voidRetrieves the coordinates of the minimum point of the givengraphene_box_t.voidRetrieves the size of the box on all three axes, and stores it into the givensizevector.static @Nullable TypegetType()Get the GType of the Box classvoidgetVertices(@Nullable Out<Vec3[]> vertices) Computes the vertices of the givengraphene_box_t.floatgetWidth()Retrieves the size of the this Box on the X axis.static Boxinfinite()A degenerategraphene_box_tthat cannot be expanded.Initializes the givengraphene_box_twith two vertices.initFromBox(Box src) Initializes the givengraphene_box_twith the vertices of anothergraphene_box_t.initFromPoints(@Nullable Point3D @Nullable [] points) Initializes the givengraphene_box_twith the given array of vertices.initFromVec3(@Nullable Vec3 min, @Nullable Vec3 max) Initializes the givengraphene_box_twith two vertices stored insidegraphene_vec3_t.initFromVectors(@Nullable Vec3 @Nullable [] vectors) Initializes the givengraphene_box_twith the given array of vertices.booleanintersection(Box b, @Nullable Box res) Intersects the two givengraphene_box_t.static BoxminusOne()Agraphene_box_twith the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).static Boxone()Agraphene_box_twith the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).static BoxAgraphene_box_twith the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).@Nullable Vec3readMax()Read the value of the fieldmax.@Nullable Vec3readMin()Read the value of the fieldmin.voidUnions the two givengraphene_box_t.voidWrite a value in the fieldmax.voidWrite a value in the fieldmin.static Boxzero()Agraphene_box_twith both the minimum and maximum vertices set at (0, 0, 0).Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Box
Create a Box proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Box
Allocate a new Box.- Parameters:
arena- to control the memory allocation scope
-
Box
public Box()Allocate a new Box. The memory is allocated withArena.ofAuto(). -
Box
-
Box
Allocate a new Box with the fields set to the provided values. The memory is allocated withArena.ofAuto().- Parameters:
min- value for the fieldminmax- value for the fieldmax
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readMin
Read the value of the fieldmin.- Returns:
- The value of the field
min
-
writeMin
Write a value in the fieldmin.- Parameters:
min- The new value for the fieldmin
-
readMax
Read the value of the fieldmax.- Returns:
- The value of the field
max
-
writeMax
Write a value in the fieldmax.- Parameters:
max- The new value for the fieldmax
-
alloc
Allocates a newgraphene_box_t.The contents of the returned structure are undefined.
- Returns:
- the newly allocated
graphene_box_tstructure. Use graphene_box_free() to free the resources allocated by this function - Since:
- 1.2
-
empty
A degenerategraphene_box_tthat can only be expanded.The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
infinite
A degenerategraphene_box_tthat cannot be expanded.The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
minusOne
Agraphene_box_twith the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
one
Agraphene_box_twith the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
oneMinusOne
Agraphene_box_twith the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
zero
Agraphene_box_twith both the minimum and maximum vertices set at (0, 0, 0).The returned value is owned by Graphene and should not be modified or freed.
- Returns:
- a
graphene_box_t - Since:
- 1.2
-
containsBox
Checks whether thegraphene_box_tthis Box contains the givengraphene_box_tb.- Parameters:
b- agraphene_box_t- Returns:
trueif the box is contained in the given box- Since:
- 1.2
-
containsPoint
Checks whether this Box contains the givenpoint.- Parameters:
point- the coordinates to check- Returns:
trueif the point is contained in the given box- Since:
- 1.2
-
equal
Checks whether the two given boxes are equal.- Parameters:
b- agraphene_box_t- Returns:
trueif the boxes are equal- Since:
- 1.2
-
expand
-
expandScalar
Expands the dimensions of this Box by the givenscalarvalue.If
scalaris positive, thegraphene_box_twill grow; ifscalaris negative, thegraphene_box_twill shrink.- Parameters:
scalar- a scalar valueres- return location for the expanded box- Since:
- 1.2
-
expandVec3
-
free
public void free()Frees the resources allocated by graphene_box_alloc().- Since:
- 1.2
-
getBoundingSphere
Computes the boundinggraphene_sphere_tcapable of containing the givengraphene_box_t.- Parameters:
sphere- return location for the bounding sphere- Since:
- 1.2
-
getCenter
Retrieves the coordinates of the center of agraphene_box_t.- Parameters:
center- return location for the coordinates of the center- Since:
- 1.2
-
getDepth
public float getDepth()Retrieves the size of the this Box on the Z axis.- Returns:
- the depth of the box
- Since:
- 1.2
-
getHeight
public float getHeight()Retrieves the size of the this Box on the Y axis.- Returns:
- the height of the box
- Since:
- 1.2
-
getMax
Retrieves the coordinates of the maximum point of the givengraphene_box_t.- Parameters:
max- return location for the maximum point- Since:
- 1.2
-
getMin
Retrieves the coordinates of the minimum point of the givengraphene_box_t.- Parameters:
min- return location for the minimum point- Since:
- 1.2
-
getSize
Retrieves the size of the box on all three axes, and stores it into the givensizevector.- Parameters:
size- return location for the size- Since:
- 1.2
-
getVertices
-
getWidth
public float getWidth()Retrieves the size of the this Box on the X axis.- Returns:
- the width of the box
- Since:
- 1.2
-
init
-
initFromBox
-
initFromPoints
Initializes the givengraphene_box_twith the given array of vertices.If
nPointsis 0, the returned box is initialized with graphene_box_empty().- Parameters:
points- an array ofgraphene_point3d_t- Returns:
- the initialized
graphene_box_t - Since:
- 1.2
-
initFromVec3
Initializes the givengraphene_box_twith two vertices stored insidegraphene_vec3_t.- Parameters:
min- the coordinates of the minimum vertexmax- the coordinates of the maximum vertex- Returns:
- the initialized
graphene_box_t - Since:
- 1.2
-
initFromVectors
Initializes the givengraphene_box_twith the given array of vertices.If
nVectorsis 0, the returned box is initialized with graphene_box_empty().- Parameters:
vectors- an array ofgraphene_vec3_t- Returns:
- the initialized
graphene_box_t - Since:
- 1.2
-
intersection
Intersects the two givengraphene_box_t.If the two boxes do not intersect,
reswill contain a degenerate box initialized with graphene_box_empty().- Parameters:
b- agraphene_box_tres- return location for the result- Returns:
- true if the two boxes intersect
- Since:
- 1.2
-
union
-