# 2.1. Geometric Primitives¶

class raysect.primitive.Box

A box primitive.

The box is defined by lower and upper points in the local co-ordinate system.

Parameters: lower (Point3D) – Lower point of the box (default = Point3D(-0.5, -0.5, -0.5)). upper (Point3D) – Upper point of the box (default = Point3D(0.5, 0.5, 0.5)). parent (Node) – Scene-graph parent node or None (default = None). transform (AffineMatrix3D) – An AffineMatrix3D defining the local co-ordinate system relative to the scene-graph parent (default = identity matrix). material (Material) – A Material object defining the box’s material (default = None). name (str) – A string specifying a user-friendly name for the box (default = “”).
>>> from raysect.core import Point3D, translate
>>> from raysect.primitive import Box
>>> from raysect.optical import World
>>> from raysect.optical.material import UniformSurfaceEmitter
>>> from raysect.optical.library.spectra.colours import red
>>>
>>> world = World()
>>>
>>> cube = Box(Point3D(0,0,0), Point3D(1,1,1), parent=world, transform=translate(0, 1, 0),
material=UniformSurfaceEmitter(red), name="red cube")

lower

Lower 3D coordinate of the box in primitive’s local coordinates.

Return type: Point3D
upper

Upper 3D coordinate of the box in primitive’s local coordinates.

Return type: Point3D
class raysect.primitive.Sphere

A sphere primitive.

The sphere is centered at the origin of the local co-ordinate system.

Parameters: radius (float) – Radius of the sphere in meters (default = 0.5). parent (Node) – Scene-graph parent node or None (default = None). transform (AffineMatrix3D) – An AffineMatrix3D defining the local co-ordinate system relative to the scene-graph parent (default = identity matrix). material (Material) – A Material object defining the sphere’s material (default = None). name (str) – A string specifying a user-friendly name for the sphere (default = “”). radius (float) – The radius of the sphere in meters.
>>> from raysect.core import translate
>>> from raysect.primitive import Sphere
>>> from raysect.optical import World
>>> from raysect.optical.material import UniformSurfaceEmitter
>>> from raysect.optical.library.spectra.colours import orange
>>>
>>> world = World()
>>>
>>> sphere = Sphere(2.5, parent=world, transform=translate(3, 0, 0),
material=UniformSurfaceEmitter(orange), name="orange sphere")

radius

Return type: float
class raysect.primitive.Cylinder

A cylinder primitive.

The cylinder is defined by a radius and height. It lies along the z-axis and extends over the z range [0, height]. The ends of the cylinder are capped with disks forming a closed surface.

Parameters: radius (float) – Radius of the cylinder in meters (default = 0.5). height (float) – Height of the cylinder in meters (default = 1.0). parent (Node) – Scene-graph parent node or None (default = None). transform (AffineMatrix3D) – An AffineMatrix3D defining the local co-ordinate system relative to the scene-graph parent (default = identity matrix). material (Material) – A Material object defining the cylinder’s material (default = None). name (str) – A string specifying a user-friendly name for the cylinder (default = “”).
>>> from raysect.core import translate
>>> from raysect.primitive import Cylinder
>>> from raysect.optical import World
>>> from raysect.optical.material import UniformSurfaceEmitter
>>> from raysect.optical.library.spectra.colours import blue
>>>
>>> world = World()
>>>
>>> cylinder = Cylinder(0.5, 2.0, parent=world, transform=translate(0, 0, 1),
material=UniformSurfaceEmitter(blue), name="blue cylinder")

height

Extent of the cylinder along the z-axis.

radius

Radius of the cylinder in x-y plane.

class raysect.primitive.Cone

A cone primitive.

The cone is defined by a radius and height. It lies along the z-axis and extends over the z range [0, height]. The tip of the cone lies at z = height. The base of the cone sits on the x-y plane and is capped with a disk, forming a closed surface.

Parameters: radius (float) – Radius of the cone in meters in x-y plane (default = 0.5). height (float) – Height of the cone in meters (default = 1.0). parent (Node) – Scene-graph parent node or None (default = None). transform (AffineMatrix3D) – An AffineMatrix3D defining the local co-ordinate system relative to the scene-graph parent (default = identity matrix). material (Material) – A Material object defining the cone’s material (default = None). name (str) – A string specifying a user-friendly name for the cone (default = “”).
>>> from raysect.core import translate
>>> from raysect.primitive import Box
>>> from raysect.optical import World
>>> from raysect.optical.material import UniformSurfaceEmitter
>>> from raysect.optical.library.spectra.colours import green
>>>
>>> world = World()
>>>
>>> cone = Cone(0.5, 2.0, parent=world, transform=translate(0, 0, 1),
material=UniformSurfaceEmitter(green), name="green cone")

height

The extend of the cone along the z-axis

radius

The radius of the cone base in the x-y plane

class raysect.primitive.Parabola

A parabola primitive.

The parabola is defined by a radius and height. It lies along the z-axis and extends over the z range [0, height]. The base of the parabola is capped with a disk forming a closed surface. The base of the parabola lies on the x-y plane, the parabola vertex (tip) lies at z=height.

Parameters: radius (float) – Radius of the parabola in meters (default = 0.5). height (float) – Height of the parabola in meters (default = 1.0). parent (Node) – Scene-graph parent node or None (default = None). transform (AffineMatrix3D) – An AffineMatrix3D defining the local co-ordinate system relative to the scene-graph parent (default = identity matrix). material (Material) – A Material object defining the parabola’s material (default = None). name (str) – A string specifying a user-friendly name for the parabola (default = “”).
>>> from raysect.core import translate
>>> from raysect.primitive import Parabola
>>> from raysect.optical import World
>>> from raysect.optical.material import UniformSurfaceEmitter
>>> from raysect.optical.library.spectra.colours import yellow
>>>
>>> world = World()
>>>
>>> parabola = Parabola(0.5, 2.0, parent=world, transform=translate(0, 0, 1),
material=UniformSurfaceEmitter(yellow), name="yellow parabola")

height

The parabola’s extent along the z-axis [0, height].

radius

Radius of the parabola base in x-y plane.