Graphene.Sphere

Fields

Name

Type

Access

Description

center

Graphene.Vec3

r

radius

float

r

Methods

class

alloc ()

contains_point (point)

distance (point)

equal (b)

free ()

get_bounding_box ()

get_center ()

get_radius ()

init (center, radius)

init_from_points (points, center)

init_from_vectors (vectors, center)

is_empty ()

translate (point)

Details

class Graphene.Sphere

A sphere, represented by its center and radius.

New in version 1.2.

classmethod alloc()
Returns:

the newly allocated Graphene.Sphere. Use Graphene.Sphere.free() to free the resources allocated by this function

Return type:

Graphene.Sphere

Allocates a new Graphene.Sphere.

The contents of the newly allocated structure are undefined.

New in version 1.2.

contains_point(point)
Parameters:

point (Graphene.Point3D) – a Graphene.Point3D

Returns:

true if the sphere contains the point

Return type:

bool

Checks whether the given point is contained in the volume of a Graphene.Sphere.

New in version 1.2.

distance(point)
Parameters:

point (Graphene.Point3D) – a Graphene.Point3D

Returns:

the distance of the point

Return type:

float

Computes the distance of the given point from the surface of a Graphene.Sphere.

New in version 1.2.

equal(b)
Parameters:

b (Graphene.Sphere) – a Graphene.Sphere

Returns:

true if the spheres are equal

Return type:

bool

Checks whether two Graphene.Sphere are equal.

New in version 1.2.

free()

Frees the resources allocated by Graphene.Sphere.alloc().

New in version 1.2.

get_bounding_box()
Returns:

return location for the bounding box

Return type:

box: Graphene.Box

Computes the bounding box capable of containing the given Graphene.Sphere.

New in version 1.2.

get_center()
Returns:

return location for the coordinates of the center

Return type:

center: Graphene.Point3D

Retrieves the coordinates of the center of a Graphene.Sphere.

New in version 1.2.

get_radius()
Return type:

float

Retrieves the radius of a Graphene.Sphere.

New in version 1.2.

init(center, radius)
Parameters:
  • center (Graphene.Point3D or None) – the coordinates of the center of the sphere, or None for a center in (0, 0, 0)

  • radius (float) – the radius of the sphere

Returns:

the initialized Graphene.Sphere

Return type:

Graphene.Sphere

Initializes the given Graphene.Sphere with the given center and radius.

New in version 1.2.

init_from_points(points, center)
Parameters:
Returns:

the initialized Graphene.Sphere

Return type:

Graphene.Sphere

Initializes the given Graphene.Sphere 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.

New in version 1.2.

init_from_vectors(vectors, center)
Parameters:
Returns:

the initialized Graphene.Sphere

Return type:

Graphene.Sphere

Initializes the given Graphene.Sphere 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.

New in version 1.2.

is_empty()
Returns:

true if the sphere is empty

Return type:

bool

Checks whether the sphere has a zero radius.

New in version 1.2.

translate(point)
Parameters:

point (Graphene.Point3D) – the coordinates of the translation

Returns:

return location for the translated sphere

Return type:

res: Graphene.Sphere

Translates the center of the given Graphene.Sphere using the point coordinates as the delta of the translation.

New in version 1.2.