pyoptools.raytrace.shape package¶
Submodules¶
Module contents¶
-
class
pyoptools.raytrace.shape.
Shape
¶ Bases:
pyoptools.misc.picklable.picklable.Picklable
Abstract superclass for all optical surfaces shapes
Description:
Shape is an abstract superclass to define the different surfaces shapes (circular, rectangulas, etc.). This class defines an API that all subclasses must support.
The methods that must be overloaded in the subclasses are:
- Shape.hit
- This method must return TRUE if an X,Y point is inside the surface aperture if not it must return FALSE
- Shape.polylist
- This method should return a point_list, and a poly_list. The point list is a list of tuples (X,Y,Z) containing the coordinates of the points used to build the surface mesh. The poly_list is a list of tuples (n1,n2,n3,n3) containing the indices of the points in the polylist used to build each polygon that will be used to visualize the mesh.
This methods will be called by the Shape.hit method, and to create the Shape.polylist tuple, that will a point_list and a poly_list. The point_list is a list of tuples (X,Y,Z) containing the coordinates of the points used to build the surface mesh. The poly_list is a list of tuples (n1,n2,n3,n3) containing the indices of the points in the polylist used to build each polygon that will be used to visualize the mesh.
The attribute topo, will be initialized for each instance of the class with a function Z(x,y).
-
fhit
()¶ This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast.
It must be overloaded.
-
hit
()¶ This method must return TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This must work for a list of points.
It must be overloaded.
-
limits
()¶ Returns the minimum limits for the aperture It must be overloaded, for each shape
-
mesh
()¶ The X,Y are a mesh limited by size=(xi,xf,yi,yf) if size is not given (size=None), the size is given by the aperture. topo is the topography function of the surface under study. if not given, a 0 will be returned for points outside the aperture, and 1 inside the aperture
The ndat tuple, gives the number of points in the mesh.
-
pointlist
()¶ This method should return a point_list that samples adecuately the shape.
The return value must be a tuple (X,Y) where X contains the X coordinates of the points, and Y the y coordinates. It must be overloaded, for each shape
-
class
pyoptools.raytrace.shape.
Circular
¶ Bases:
pyoptools.raytrace.shape.shape.Shape
Class defining an circular shape.
-
fhit
()¶ This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast
-
hit
()¶ Method that returns True if a p=(X,Y,Z) point is inside the aperture, if not it returns False.
-
limits
()¶ Returns the minimum limits for the aperture
-
pointlist
()¶ This method should return a point_list that samples adecuately the shape.
The return value must be a tuple (X,Y) where X contains the X coordinates of the points, and Y the y coordinates. It must be overloaded, for each shape
-
radius
¶
-
samples
¶
-
-
class
pyoptools.raytrace.shape.
Rectangular
¶ Bases:
pyoptools.raytrace.shape.shape.Shape
Class defining an rectangular shape.
-
fhit
()¶ This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast
-
hit
()¶ Method that returns True if a p=(x,y,z) point is inside the rectangle, if not it returns False.
-
limits
()¶ Returns the minimum limits for the aperture
-
offset
¶
-
pointlist
()¶ This method should return a point_list that samples adecuately the shape.
The return value must be a tuple (X,Y) where X contains the X coordinates of the points, and Y the y coordinates. It must be overloaded, for each shape
-
samples
¶
-
size
¶
-
-
class
pyoptools.raytrace.shape.
Triangular
(coord=((0, 0), (0, 100), (100, 0)), samples=10, *args, **kwargs)¶ Bases:
pyoptools.raytrace.shape.shape.Shape
Class defining a triangular shape.
-
coord
¶
-
fhit
(self, double px, double py, double pz) → bool¶ This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast
-
hit
(self, p)¶ Method that returns True if a p=(x,y,z) point is inside the triangle, if not it returns False. taken from http://www.blackpawn.com/texts/pointinpoly/default.html
-
limits
(self)¶ Returns the minimum limits for the aperture
-
pointlist
(self)¶
-
samples
¶
-
-
class
pyoptools.raytrace.shape.
Polygon
(coord=((0, 0), (0, 100), (100, 0)), samples=10, *args, **kwargs)¶ Bases:
pyoptools.raytrace.shape.shape.Shape
class defining a polygonal shape
- Args:
- coords (tuple): Tuple containing the coordinates of the 3 corners
- of a triangle. Each coordinate is a(float, float) tuple.
- samples (int): Number of subdivitions per side used to sample the
- triangle.
Todo
- This class is a copy of the Triangular class. Need to be implemented correctly.
-
coord
¶
-
fhit
(self, double px, double py, double pz) → bool¶ This method returns TRUE if an p=(x,y,z)point is inside the surface aperture if not it must return FALSE. This is implemented for a point, in cython, to make it fast
-
hit
(self, p)¶ Method that returns True if a p=(x,y,z) point is inside the triangle, if not it returns False. taken from http://www.blackpawn.com/texts/pointinpoly/default.html
-
limits
(self)¶ Returns the minimum limits for the aperture
-
pointlist
(self)¶
-
samples
¶