 # Sensor Reflection and Mirrors

## Information

Notes/Code
 This goes through the process to model a sensor reflection on a flat surface of an object within STK. It involves using Analysis Workbench (AWB), custom integration scripts in MATLAB, and multiple sensors to simulate the reflection.This uses scripts in MATLAB, but if you can understand the workflow of the code, you can create the components in STK via the GUI as well. The instructions below are supplements to the code named “Mirror Component Creator” which assists to create all of the VGT components. These are using the assumption that you have a mirror object in STK that has attach points at the top, bottom, left, right, and center of the mirror, along with a defined point at the origin of where the sensor is propagated from. This script is made for a sensor that is pointed towards a mirror in close proximity, but the theory still applies for different applications. Some changes will have to be made.One thing that is important is that the reflection of the sensor needs some reference points from the mirror. You need to create specific attach points within the 3d model of the mirror that will allow you to certain analysis workbench components detailed below. Certain attach points that are needed are the left, right, up, bottom most points, and the center of the mirror like the image below. This is so the mirror can be properly referenced in analysis workbench.  A plane will be created utilizing these points so the rest of our analysis workbench components can reference the mirror face. Create a Plane component of type triad with Point A and Point B defined as two of the edge points such that the horizontal and vertical components of the mirror are correctly lined up with this plane (i.e Point A: MirrorBottom, Point B: MirrorRight). Make sure that the Reference Point is the point defined as the center of the mirror.What is also important is how far away the origin of the initial sensor is as well. The distance of its boresight relative to the mirror needs to be taken into account as well so we need to create a distance to the mirror vector. So now we have the location of the mirror and the origin of the sensor. Next, we need to make sure that we have the pointing direction of the sensor. This depends on how you have defined the sensor pointing direction. Make sure that you have your sensor pointing in the correct direction towards your mirror. If you sensor is pointing towards the correct direction, we can utilize the predefined vector known as the sensor boresight to define where the sensor boresight intersects the mirror by using the AWB Point type known as Intersection! So now, we need to take note of how far the intersection is to the plane, by creating a displacement vector from the sensor origin to the intersection point. Here you will define the direction vector as the boresight vector, the reference plane as the MirrorPlane that was previously created, and define the origin point as the Sensor origin. So now we have the point where the boresight intersects the mirror. We now need to know where to point our reflection sensor in order to be accurate. Luckily, STK has a reflection vector type! Before we create this vector, we need to create a vector that is normal of the reflecting plane, which is needed for the reflection vector type. However, in order to create this normal, we need two reference vectors to get the normal vector. To create these vectors, we need to generate two displacement vectors that reference the mirror points. The first one will be called MirrorHorizontal, and will use the Origin Point as the Mirror Center and the Destination as Mirror Left. The next is MirrorVertical, and has the same Origin Point as the Mirror Center but this time the destination will be the Mirror Down point. Now we have the references for the mirror normal vector, so let us create that! Go ahead and create a vector of type normal, and choose the two vectors MirrorHorizontal and MirrorVertical, as Vectors A and B respectively. With that complete, we will now model the reflection vector. Create a vector of type Reflection. The incident vector should be the boresight vector that we used to generate the intersection point. Normal Vector of reflecting plane is going to be the Normal Vector that we had just created. Make sure that the Allow reflections on back of place options is checked. This vector is pointing in the direction that the sensor will point after reflecting off of the mirror. We actually want to create the exact same vector a second time, but also check the box that says Use opposite of selected vector. This is the same of the reflection vector, but is in the virtual direction. Name this as the virtual vector. Now we have our reflection direction and the origin point of the boresight! The final thing to do is to create the virtual sensor origin. This is the location of the sensor in the reflection. Basically, if you were to shine a laser pointer into a mirror (not into your own eye) and look your reflection, you would see yourself and the laser pointer. The location of the laser pointer in the mirror is the location of the virtual origin. If you stood still but moved the mirror, the virtual origin would move to portray that. This is also the reason of why we had previously checked those two options before; we wanted to have the vectors point ‘in’ the mirror to use as a start for the virtual origin. We will create an axis and system that is based on the intersection point and the reflection vector. The axis is an aligned and constrained type axes using the virtual vector and the mirror normal elevation respectively. The system uses this newly created axes and places it on the intersection point of the mirror.  With this created, we just need to create a scalar that takes the magnitude of the vector that represents the distance between the sensor origin and the intersection location. These are important because we now have an axes that determines how far the virtual sensor needs to be as well as the actual distance.The final AWB component to use is the Custom Inline Script point type in STK to create the virtual point location. The reason we need this is because the distance of the mirror from the sensor origin is not a definitive value, and the custom inline script helps us change this distance dependent on the scalar that we have previously created. So now we have all of the components in AWB created! All that is left is to insert 2 sensors and use the components to get the pointing direction and location correct. Create the first sensor as your initial sensor. Set the pointing type to along vector, and set the alignment and constraint vector to the distance to vector mirror and mirror face azimuth respectively. Set its location to the sensor origin point.Finally, create the reflected sensor, and set its pointing type to along vector. Set the alignment and constraint vectors to the reflection vector and the mirror face azimuth respectively. Set its point origin to the virtual origin. There you have it! You now have a mirror that takes a sensor and reflects it back! Easy right?
Download File MirrorComponentCreator.m