2.1. Geometric Primitives¶
- class raysect.primitive.Box¶
Bases:
Primitive
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")
- class raysect.primitive.Sphere¶
Bases:
Primitive
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 = “”).
- Variables:
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¶
The radius of this sphere.
- Return type:
float
- class raysect.primitive.Cylinder¶
Bases:
Primitive
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¶
Bases:
Primitive
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¶
Bases:
Primitive
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.
- class raysect.primitive.Torus¶
Bases:
Primitive
A torus primitive.
The torus is defined by major and minor radius. The major radius is the distance from the center of the tube to the center of the torus. The minor radius is the radius of the tube. The center of the torus corresponds to the origin of the local coordinate system. The axis of revolution coincides with the z-axis, and The center of the torus tube lies on the x-y plane.
- Parameters:
major_radius (float) – Major radius of the torus in meters (default = 1.0).
minor_radius (float) – Minor radius of the torus in meters (default = 0.5).
parent (Node) – Scene-graph parent node or None (default = None).
transform (AffineMatrix3D) – An AffineMatrix3D defining the local coordinate system relative to the scene-graph parent (default = identity matrix).
material (Material) – A Material object defining the torus’s material (default = None).
name (str) – A string specifying a user-friendly name for the torus (default = “”).
- Variables:
major_radius (float) – The major radius of the torus in meters.
minor_radius (float) – The minor radius of the torus in meters.
>>> from raysect.core import translate >>> from raysect.primitive import Torus >>> from raysect.optical import World >>> from raysect.optical.material import UniformSurfaceEmitter >>> from raysect.optical.library.spectra.colours import orange >>> >>> world = World() >>> >>> torus = Torus(1.0, 0.5, parent=world, transform=translate(3, 0, 0), material=UniformSurfaceEmitter(orange), name="orange torus")
- major_radius¶
The major radius of this torus.
- Return type:
float
- minor_radius¶
The minor radius of this torus.
- Return type:
float