ModuleMask
class
Mask:
22class Mask: 23 """ 24 A mask: a plane surface of the shape of its [Support](ModuleSupport.html), which stops all rays that hit it, 25 while all other rays continue their path unchanged. 26 27 Attributes 28 ---------- 29 support : [Support](ModuleSupport.html)-object 30 31 type : str 'Ellipsoidal Mirror'. 32 33 Methods 34 ---------- 35 get_normal(Point) 36 37 get_centre() 38 39 get_grid3D(NbPoints) 40 41 """ 42 43 def __init__(self, Support): 44 """ 45 Parameters 46 ---------- 47 Support : [Support](ModuleSupport.html)-object 48 """ 49 self.type = "Mask" 50 self.support = Support 51 52 def _get_intersection(self, Ray): 53 """Return the intersection point between Ray and the xy-plane, 54 where rays do NOT hit the mask's support""" 55 t = -Ray.point[2] / Ray.vector[2] 56 I = Ray.vector * t + Ray.point 57 if t > 0 and not self.support._IncludeSupport(I): 58 PointIntersection = I 59 else: 60 PointIntersection = None 61 62 return PointIntersection 63 64 def get_normal(self, Point): 65 """Return normal unit vector in point 'Point' on the mask.""" 66 Normal = np.array([0, 0, 1]) 67 return Normal 68 69 def get_centre(self): 70 """Return 3D coordinates of the point on the mask surface at the center of its support.""" 71 return np.array([0, 0, 0]) 72 73 def get_grid3D(self, NbPoint, **kwargs): 74 """ 75 Returns list of numpy-arrays containing the 3D-coordinates of points in the mirror surface, 76 sampling the support in a number NbPoints of points. 77 """ 78 E = "edges" in kwargs and kwargs["edges"] 79 ListCoordXYZ = [] 80 contour = int(round(0.1 * NbPoint)) 81 contours = self.support._Contour_points(contour, **kwargs) 82 if E: 83 contours, contour_edges = contours 84 ListCoordXY = contours + self.support._get_grid(NbPoint - contour) 85 for k in ListCoordXY: 86 z = 0 87 ListCoordXYZ.append(np.array([k[0], k[1], z])) 88 if E: 89 return ListCoordXYZ, contour_edges 90 return ListCoordXYZ
A mask: a plane surface of the shape of its Support, which stops all rays that hit it, while all other rays continue their path unchanged.
Attributes
support : [Support](ModuleSupport.html)-object
type : str 'Ellipsoidal Mirror'.
Methods
get_normal(Point)
get_centre()
get_grid3D(NbPoints)
Mask(Support)
43 def __init__(self, Support): 44 """ 45 Parameters 46 ---------- 47 Support : [Support](ModuleSupport.html)-object 48 """ 49 self.type = "Mask" 50 self.support = Support
Parameters
Support : [Support](ModuleSupport.html)-object
def
get_normal(self, Point):
64 def get_normal(self, Point): 65 """Return normal unit vector in point 'Point' on the mask.""" 66 Normal = np.array([0, 0, 1]) 67 return Normal
Return normal unit vector in point 'Point' on the mask.
def
get_centre(self):
69 def get_centre(self): 70 """Return 3D coordinates of the point on the mask surface at the center of its support.""" 71 return np.array([0, 0, 0])
Return 3D coordinates of the point on the mask surface at the center of its support.
def
get_grid3D(self, NbPoint, **kwargs):
73 def get_grid3D(self, NbPoint, **kwargs): 74 """ 75 Returns list of numpy-arrays containing the 3D-coordinates of points in the mirror surface, 76 sampling the support in a number NbPoints of points. 77 """ 78 E = "edges" in kwargs and kwargs["edges"] 79 ListCoordXYZ = [] 80 contour = int(round(0.1 * NbPoint)) 81 contours = self.support._Contour_points(contour, **kwargs) 82 if E: 83 contours, contour_edges = contours 84 ListCoordXY = contours + self.support._get_grid(NbPoint - contour) 85 for k in ListCoordXY: 86 z = 0 87 ListCoordXYZ.append(np.array([k[0], k[1], z])) 88 if E: 89 return ListCoordXYZ, contour_edges 90 return ListCoordXYZ
Returns list of numpy-arrays containing the 3D-coordinates of points in the mirror surface, sampling the support in a number NbPoints of points.
def
TransmitMaskRayList(Mask, RayList):
113def TransmitMaskRayList(Mask, RayList): 114 """ 115 Returns the the transmitted rays that pass the mask for the list of 116 incident rays ListRay. 117 118 Rays that hit the support are not further propagated. 119 120 Updates the reflected rays' incidence angle and path. 121 122 Parameters 123 ---------- 124 Mask : Mask-object 125 126 ListRay : list[Ray-object] 127 128 """ 129 ListRayTransmitted = [] 130 for Ray in RayList: 131 PointMask = Mask._get_intersection(Ray) 132 133 if PointMask is not None: 134 RayTransmitted = _TransmitMaskRay(Mask, PointMask, Ray) 135 ListRayTransmitted.append(RayTransmitted) 136 137 return ListRayTransmitted
Returns the the transmitted rays that pass the mask for the list of incident rays ListRay.
Rays that hit the support are not further propagated.
Updates the reflected rays' incidence angle and path.
Parameters
Mask : Mask-object
ListRay : list[Ray-object]
Last modified April 8, 2024: Merge pull request #11 from mightymightys/dev (60da018)