fresnel.geometry¶
Overview
fresnel.geometry.Geometry |
Base class for all geometry. |
fresnel.geometry.Cylinder |
Cylinder geometry. |
fresnel.geometry.ConvexPolyhedron |
Convex polyhedron geometry. |
fresnel.geometry.Sphere |
Sphere geometry. |
Details
Geometric primitives.
-
class
fresnel.geometry.
ConvexPolyhedron
(scene, origins, normals, r, face_colors=None, position=None, orientation=None, color=None, N=None, material=<fresnel.material.Material object>, outline_material=<fresnel.material.Material object>, outline_width=0.0)¶ Convex polyhedron geometry.
Define a set of convex polyhedron primitives. A convex polyhedron is defined by P outward facing planes (origin and normal vector) and a radius that encompass the shape.
Note: Future versions may (or may not) provide a more user friendly interface.
Parameters: - scene (
fresnel.Scene
) – Add the geometry to this scene - origins – Origins of the planes in particle local coordinates. Type: anything convertible by numpy to a Px3 array of floats.
- normals – Origins of the planes in particle local coordinates. Type: anything convertible by numpy to a Px3 array of floats.
- r (float) – Radius of the circumscribing sphere (centered at the origin) that encompasses the polyhedron.
- face_colors – Colors of the polyhedron faces Type: anything convertible by numpy to a Px3 array of floats.
- position – Positions of the polyhedra, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- orientation – Rotation quaternion of each polyhedron, optional. Type: anything convertible by numpy to a Nx4 array of floats.
- color – (r,g,b) color of each particle, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- N (int) – Number of spheres in the geometry. If
None
, determineN
fromposition
.
Note
The constructor arguments
position
,orientation
, andcolor
are optional, and just short-hand for assigning the attribute after construction.Colors are in the linearized sRGB color space. Use
fresnel.color.linear()
to convert standard sRGB colors into this space.Hint
Avoid costly memory allocations and type conversions by specifying primitive properties in the appropriate numpy array type.
-
position
¶ fresnel.util.array
– Read or modify the positions of the prisms.
-
orientation
¶ fresnel.util.array
– Read or modify the orientations of the prisms.
-
color
¶ fresnel.util.array
– Read or modify the color of the prisms.
-
color_by_face
¶ float – Set to 0 to color particles by the per-particle color. Set to 1 to color faces by the per-face color.
-
get_extents
()¶ Get the extents of the geometry
Returns: - [[minimum x, minimum y, minimum z],
- [maximum x, maximum y, maximum z]]
- scene (
-
class
fresnel.geometry.
Cylinder
(scene, points=None, radius=None, color=None, N=None, material=<fresnel.material.Material object>, outline_material=<fresnel.material.Material object>, outline_width=0.0)¶ Cylinder geometry.
Define a set of cylinder primitives with start and end positions, radii, and individual colors.
Parameters: - scene (
fresnel.Scene
) – Add the geometry to this scene - points – cylinder start and end points, optional. Type: anything convertible by numpy to a Nx2x3 array of floats.
- radius – Radius of each cylinder, optional. Type: anything convertible by numpy to a N length array of floats.
- color – (r,g,b) color of each particle, optional. Type: anything convertible by numpy to a Nx2x3 array of floats.
- N (int) – Number of cylinders in the geometry. If
None
, determineN
fromposition
.
Note
The constructor arguments
points
,radius
, andcolor
are optional, and just short-hand for assigning the properties after construction.Colors are in the linearized sRGB color space. Use
fresnel.color.linear()
to convert standard sRGB colors into this space.Hint
Avoid costly memory allocations and type conversions by specifying primitive properties in the appropriate numpy array type.
-
points
¶ fresnel.util.array
– Read or modify the start and end points of the cylinders.
-
radius
¶ fresnel.util.array
– Read or modify the radii of the cylinders.
-
color
¶ fresnel.util.array
– Read or modify the colors of the start and end points of the cylinders.
-
get_extents
()¶ Get the extents of the geometry
Returns: - [[minimum x, minimum y, minimum z],
- [maximum x, maximum y, maximum z]]
- scene (
-
class
fresnel.geometry.
Geometry
¶ Base class for all geometry.
Geometry
provides operations common to all geometry classes.-
material
¶ fresnel.material.Material
– Read, set, or modify the geometry’s material.
-
outline_material
¶ fresnel.material.Material
– Read, set, or modify the geometry’s outline material.
-
outline_width
¶ float
– The geometry’s outline width, in distance units in the scene’s coordinate system.
Note
You cannot instantiate a Geometry directly. Use one of the sub classes.
-
disable
()¶ Disable the geometry.
When disabled, the geometry will not be present in the scene. No rays will intersect it.
-
enable
()¶ Enable the geometry.
When enabled, the geometry will be present when rendering the scene.
-
-
class
fresnel.geometry.
Prism
(scene, vertices, position=None, angle=None, height=None, color=None, N=None, material=<fresnel.material.Material object>, outline_material=<fresnel.material.Material object>, outline_width=0.0)¶ Prism geometry.
Define a set of right convex prism primitives. The bottom polygon face is always in the xy plane. Each prism may have a different height and rotation angle.
Parameters: - scene (
fresnel.Scene
) – Add the geometry to this scene - vertices – The vertices of the polygon in a counter clockwise winding direction. Type: anything convertible by numpy to a Nx2 array of floats.
- position – Positions of the prisms, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- height – Height of each prism in the z direction, optional. Type: anything convertible by numpy to a N length array of floats.
- angle – Rotation angle of each prism (in radians), optional. Type: anything convertible by numpy to a N length array of floats.
- color – (r,g,b) color of each particle, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- N (int) – Number of spheres in the geometry. If
None
, determineN
fromposition
.
Note
The constructor arguments
position
,height
,angle
, andcolor
are optional, and just short-hand for assigning the attribute after construction.Colors are in the linearized sRGB color space. Use
fresnel.color.linear()
to convert standard sRGB colors into this space.Hint
Avoid costly memory allocations and type conversions by specifying primitive properties in the appropriate numpy array type.
-
position
¶ fresnel.util.array
– Read or modify the positions of the prisms.
-
height
¶ fresnel.util.array
– Read or modify the heights of the prisms.
-
angle
¶ fresnel.util.array
– Read or modify the angles of the prisms.
-
color
¶ fresnel.util.array
– Read or modify the color of the prisms.
- scene (
-
class
fresnel.geometry.
Sphere
(scene, position=None, radius=None, color=None, N=None, material=<fresnel.material.Material object>, outline_material=<fresnel.material.Material object>, outline_width=0.0)¶ Sphere geometry.
Define a set of sphere primitives with positions, radii, and individual colors.
Parameters: - scene (
fresnel.Scene
) – Add the geometry to this scene - position – Positions of the spheres, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- radius – Radius of each sphere, optional. Type: anything convertible by numpy to a N length array of floats.
- color – (r,g,b) color of each particle, optional. Type: anything convertible by numpy to a Nx3 array of floats.
- N (int) – Number of spheres in the geometry. If
None
, determineN
fromposition
.
Note
The constructor arguments
position
,radius
, andcolor
are optional, and just short-hand for assigning the properties after construction.Colors are in the linearized sRGB color space. Use
fresnel.color.linear()
to convert standard sRGB colors into this space.Hint
Avoid costly memory allocations and type conversions by specifying primitive properties in the appropriate numpy array type.
-
position
¶ fresnel.util.array
– Read or modify the positions of the spheres.
-
radius
¶ fresnel.util.array
– Read or modify the radii of the spheres.
-
color
¶ fresnel.util.array
– Read or modify the color of the spheres.
-
get_extents
()¶ Get the extents of the geometry
Returns: - [[minimum x, minimum y, minimum z],
- [maximum x, maximum y, maximum z]]
- scene (