Defines a set of functions for intersecting a ray and a surface.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | n |
Normal to the circle |
||
type(vector), | intent(in) | :: | p0 |
a centre of the circle |
||
real(kind=wp), | intent(in) | :: | radius |
Radius of the circle |
||
type(vector), | intent(in) | :: | l0 |
origin of the ray |
||
type(vector), | intent(in) | :: | l |
direction vector of the ray |
||
real(kind=wp), | intent(inout) | :: | t |
Distance from l0 to the intersection point |
calculates where a line, with origin:orig and direction:dir hits a cone, radius:radius and height:height with centre:centre. centre is the point under the apex at the cone's base. returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel and pbrt need to check z height after moving ray if not this is an infinte cone cone lies height ways along z-axis
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | orig |
origin of the ray |
||
type(vector), | intent(in) | :: | dir |
Direction vector of the ray |
||
real(kind=wp), | intent(out) | :: | t |
distance from orig to the intersection point |
||
type(vector), | intent(in) | :: | centre |
Centre of the cone |
||
real(kind=wp), | intent(in) | :: | radius |
Radius of the cones base |
||
real(kind=wp), | intent(in) | :: | height |
Height of the cone |
calculates where a line, with origin:orig and direction:dir hits a cylinder, centre:centre and radius:radius This solves for an infinitely long cylinder centered on the z axis with radius radius returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel need to check z height after moving ray if not this is an infinite cylinder
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | orig |
origin of the ray |
||
type(vector), | intent(in) | :: | dir |
Direction vector of the ray |
||
real(kind=wp), | intent(out) | :: | t |
distance from orig to the intersection point |
||
type(vector), | intent(in) | :: | centre |
Centre of the cylinder |
||
real(kind=wp), | intent(in) | :: | radius |
radius of the cylinder |
calculates where a line, with origin:orig and direction:dir hits a ellipse, centre:centre and axii:semia, semib returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel and pbrt need to check z height after moving ray if not this is an infinte ellipse-cylinder ellipse lies length ways along z-axis semia and semib are the semimajor axis which are the half width and height.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | orig |
origin of the ray |
||
type(vector), | intent(in) | :: | dir |
Direction vector of the ray |
||
real(kind=wp), | intent(out) | :: | t |
distance from orig to the intersection point |
||
type(vector), | intent(in) | :: | centre |
Centre of the ellipse |
||
real(kind=wp), | intent(in) | :: | semia |
Half width of the ellipse |
||
real(kind=wp), | intent(in) | :: | semib |
Half height of the ellipse |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | n |
Normal to the plane |
||
type(vector), | intent(in) | :: | p0 |
a point on the plane |
||
type(vector), | intent(in) | :: | l0 |
origin of the ray |
||
type(vector), | intent(in) | :: | l |
direction vector of the ray |
||
real(kind=wp), | intent(inout) | :: | t |
Distance from l0 to the intersection point |
calculates where a line, with origin:orig and direction:dir hits a sphere, centre:centre and radius:radius returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | orig |
Origin of the ray |
||
type(vector), | intent(in) | :: | dir |
Direction vector of the ray |
||
real(kind=wp), | intent(out) | :: | t |
Distance from orig to the intersection point |
||
type(vector), | intent(in) | :: | centre |
Centre of the sphere |
||
real(kind=wp), | intent(in) | :: | radius |
Radius of the sphere |
solves quadratic equation given coeffs a, b, and c returns true if real solution returns x0 and x1 adapted from scratchapixel
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | a | |||
real(kind=wp), | intent(in) | :: | b | |||
real(kind=wp), | intent(in) | :: | c | |||
real(kind=wp), | intent(out) | :: | x0 | |||
real(kind=wp), | intent(out) | :: | x1 |