RobinTrace is a sequential raytracing API for optical design. It is implemented in C++.
RobinTrace aims at a minimal set of features which make it a usable tool for optical design raytracing. Note this is not a standalone optical design program but rather a toolkit for the raytracing involved in optical design. The scope may be summarized as follows.
We decomposed the program into three layers of ascending abstraction.
Here is an example which shows some of the API in bottom-up fashion.
#include <iostream>
#include <vector>
#include <memory>
int main(){
std::cout << "# Main #" << std::endl;
std::cout << "## Poaky ##" << std::endl;
std::cout << "ray is valid? " << r.is_valid() << std::endl;
std::cout << sd << std::endl;
std::cout << "ray before intersection: " << r << std::endl;
sd.intersect(r);
std::cout << "ray after intersection: " << r << std::endl;
std::cout << "normal vector: " << N << std::endl;
std::cout << tfr << std::endl;
std::cout << "## Pinyo ##" << std::endl;
std::vector<ray> rays;
rays.push_back(r1); rays.push_back(r2);
std::cout << "Before transfer: " << b << std::endl;
std::cout << trfp << std::endl;
trfp.apply(b);
std::cout << "After transfer: " << b << std::endl;
std::cout << srp << std::endl;
srp.apply(b);
std::cout << "After standard reflective part: " << b << std::endl;
std::cout << "## Pewit ##" << std::endl;
std::vector<ray> rays_ls;
rays_ls.push_back(r1_ls); rays_ls.push_back(r2_ls);
ray_buns.push_back(b_ls);
ray_buns.push_back(b2_ls);
ls.parts.at(0).save_rays = true;
ls.parts.at(1).save_rays = true;
ls.trace_remaining();
std::cout << rays_surf0.
ray_buns << std::endl;
std::cout << rays_surf1.
ray_buns << std::endl;
ls.compute_parts_global_position();
<< std::endl;
ls.parts.at(1).compute_semi_diameter();
std::cout <<
"Semi-diameter: " << sdia.
value << std::endl;
ls.parts.at(1).compute_global_rays();
std::cout << "Global rays of part 1: " << std::endl
ls.parts.at(1).compute_propagation_direction();
const auto &propagation_direction =
std::cout << "Local rays propagation direction at part 1: "
<< propagation_direction.validity << std::endl;
}
Eigen::Vector3d Vec3
Definition: Vec3.h:11
Class for ray bundles.
Definition: bun.h:13
Vector of lparts.
Definition: lpart_vec.h:12
void add_lpart(T part)
Add a lpart to the vector.
Definition: lpart_vec.h:21
The global coordinates position of a lseq renderable part.
Definition: lseq_part_global_position.h:9
Saved ray states at a lseq part expressed in global coordinates.
Definition: lseq_part_global_rays.h:9
ray_pack ray_buns
Ray states.
Definition: lseq_part_global_rays.h:12
Propagation direction of the lseq_part_rays.
Definition: lseq_part_propagation_direction.h:8
bool direction
The propagation direction of the rays.
Definition: lseq_part_propagation_direction.h:13
Saved ray states at a lseq part.
Definition: lseq_part_rays.h:9
ray_pack ray_buns
Saved ray states.
Definition: lseq_part_rays.h:12
Part semi-diameter from the ray states results.
Definition: lseq_part_semi_diameter.h:8
double value
The semi-diameter value.
Definition: lseq_part_semi_diameter.h:11
Input rays to lseq.
Definition: lseq_rays.h:9
Top-level API for robintrace. Holds parts, rays and manages the computations.
Definition: lseq.h:16
Class for individual rays.
Definition: ray.h:9
Class template implementing the specialized lparts for reflective shape parts.
Definition: shape_part.h:11
Standard shape specialization.
Definition: standard.h:9
Part which applies a transfer operation to rays.
Definition: transfer_part.h:9
Transfer operation over a ray.
Definition: transfer.h:40
std::vector< bun > ray_pack
Vector of ray bundles.
Definition: ray_pack.h:12