Geometry routines

NSPOC.jl has efficient data structures for many geometric constructors (2D and 3D vectors., lines, planes, etc...). The module Geometry includes typical operations with these geometric types. An advantage of the NSPOC.jl structures is that are of type isbits allowing its use in modern GPU accelarators.

Vector data types

By far the most common structures are 3D vectors with Float64 (i.e. double precision) components. An example of its use:

  Activating project at `~/code/julia/NSPOC`
julia> a = Vec3DF64((1.0,2.3,-0.45))Vec3D{Float64}((1.0, 2.3, -0.45))
julia> b = Vec3DF64((0.34,-3.3,1.81))Vec3D{Float64}((0.34, -3.3, 1.81))
julia> println(dot(a,b))-8.064499999999999
julia> println(cross(a,b))Vec3D{Float64}((2.6779999999999995, -1.963, -4.082))
julia> println(cross(a+b,b))Vec3D{Float64}((2.6780000000000004, -1.963, -4.082))
julia> println(cross(a-3*b,b))Vec3D{Float64}((2.678000000000001, -1.963, -4.082))
NSPOC.Geometry.Vec2DF64Type
Vec2DF64

Two and three dimensional vectors with components of type Float64. This is an alias for Vec2D{Float64}.

source
NSPOC.Geometry.Vec3DF64Type
Vec3DF64

Two and three dimensional vectors with components of type Float64. This is an alias for Vec3D{Float64}.

source

Vector Operations

Vector can be added/substracted in the usual way. Moreover there exists the following methods

LinearAlgebra.dotFunction
dot(a::VecD{N,T}, b::VecD{N,T}) where {N,T}

Returns the dot product of vectors a and b.

source
LinearAlgebra.crossFunction
cross(a::VecD{N,T}, b::VecD{N,T}) where {N,T}

If input are 3D vectors, returns the cross product of vectors a and b. If the input are 3D vectors, returns the number axby-aybx

source
Base.angleFunction
angle(a::Vec3D{T},b::Vec3D{T}) where {T}

Returns the angle formed by the vectors a and b. By convention this returns the minimal angle without sign (i.e. angle(a,b) == angle(b,a)).

source
NSPOC.Geometry.tanangleFunction
tanangle(a::Vec3D{T},b::Vec3D{T}) where {T}

Returns the tangent of the angle formed by the vectors a and b.

source

Other geometric types

Lines

We can define lines in 2D or in 3D.

Planes always live in 3D

Planes

NSPOC.Geometry.PlaneType
Plane{T}

A plane in 3D space. The constructor supports giving either one point and a normal vector Plane(pt,normal) or three points Plane(p1,p2,p3).

source

2D Regions in 3D space

We have the following planar regions.

Missing docstring.

Missing docstring for Ellipse. Check Documenter's build log for details.

2D Polygons

Two dimensional polygons play a central role in the determination of the blocking and shadowing effects. We have the