ModuleSurface

Provides classes for different reflective surfaces.

Created in Nov 2024

@author: Andre Kalouguine

 1"""
 2Provides classes for different reflective surfaces.
 3
 4Created in Nov 2024
 5
 6@author: Andre Kalouguine
 7"""
 8import ARTcore.ModuleGeometry as mgeo
 9
10import numpy as np
11from copy import copy
12from abc import ABC, abstractmethod
13
14
15class Surface(ABC):
16    """
17    Abstract base class for surfaces.
18    
19    This is where we should ideally define the roughness, scratches/digs, spectral response, etc.
20
21    As for the global sag, that might be better defined in the optical elements themselves.
22    """
23    pass
24
25class IdealSurface(Surface):
26    """
27    Ideal surface, i.e. no roughness, no scratches, no digs, no spectral response.
28    """
29    def __init__(self):
30        super().__init__()
31    def reflect_ray(self, ray, point, normal):
32        VectorRay = ray.vector
33        VectorRayReflected = VectorRay-2*normal*np.dot(VectorRay,normal) # Is it any better than SymmetricalVector?
34        local_reflectedray = copy(ray)
35        local_reflectedray.point = point
36        local_reflectedray.vector = VectorRayReflected
37        local_reflectedray.incidence = mgeo.AngleBetweenTwoVectors(-VectorRay, normal)
38        new_length = np.linalg.norm(point - ray.point)
39        local_reflectedray.path  = ray.path + (new_length,)
40        return local_reflectedray
41    
class Surface(abc.ABC):
16class Surface(ABC):
17    """
18    Abstract base class for surfaces.
19    
20    This is where we should ideally define the roughness, scratches/digs, spectral response, etc.
21
22    As for the global sag, that might be better defined in the optical elements themselves.
23    """
24    pass

Abstract base class for surfaces.

This is where we should ideally define the roughness, scratches/digs, spectral response, etc.

As for the global sag, that might be better defined in the optical elements themselves.

class IdealSurface(Surface):
26class IdealSurface(Surface):
27    """
28    Ideal surface, i.e. no roughness, no scratches, no digs, no spectral response.
29    """
30    def __init__(self):
31        super().__init__()
32    def reflect_ray(self, ray, point, normal):
33        VectorRay = ray.vector
34        VectorRayReflected = VectorRay-2*normal*np.dot(VectorRay,normal) # Is it any better than SymmetricalVector?
35        local_reflectedray = copy(ray)
36        local_reflectedray.point = point
37        local_reflectedray.vector = VectorRayReflected
38        local_reflectedray.incidence = mgeo.AngleBetweenTwoVectors(-VectorRay, normal)
39        new_length = np.linalg.norm(point - ray.point)
40        local_reflectedray.path  = ray.path + (new_length,)
41        return local_reflectedray

Ideal surface, i.e. no roughness, no scratches, no digs, no spectral response.

def reflect_ray(self, ray, point, normal):
32    def reflect_ray(self, ray, point, normal):
33        VectorRay = ray.vector
34        VectorRayReflected = VectorRay-2*normal*np.dot(VectorRay,normal) # Is it any better than SymmetricalVector?
35        local_reflectedray = copy(ray)
36        local_reflectedray.point = point
37        local_reflectedray.vector = VectorRayReflected
38        local_reflectedray.incidence = mgeo.AngleBetweenTwoVectors(-VectorRay, normal)
39        new_length = np.linalg.norm(point - ray.point)
40        local_reflectedray.path  = ray.path + (new_length,)
41        return local_reflectedray