Geometry types and algorithms.

Special thanks to:

  • Tomasz Stachowiak (h3r3tic): allowed me to use parts of omg.
  • Jakob Øvrum (jA_cOp): improved the code a lot!
  • Florian Boesch (___doc__): helps me to understand opengl/complex maths better, see: http://codeflow.org/.
  • #D on freenode: answered general questions about D.

Note: All methods marked with pure are weakly pure since, they all access an instance member. All static methods are strongly pure.

TODO Support radian and degree types (from units-d package)

TODO Use sink as param in toMathML and toLaTeX

TODO Replace toMathML() with fmt argument %M to toString functions TODO Replace toLaTeX() with fmt argument %L to toString functions

TODO Optimize using core.simd or std.simd TODO Merge with analyticgeometry TODO Merge with https://github.com/CyberShadow/ae/blob/master/utils/geometry.d TODO Integrate with http://code.dlang.org/packages/blazed2 TODO logln, log.warn, log.error, log.info, log.debug TODO Make use of staticReduce etc when they become available in Phobos. TODO Go through all usages of real and use CommonType!(real, E) to make it work when E is a bignum. TODO ead and perhaps make use of http://stackoverflow.com/questions/3098242/fast-vector-struct-that-allows-i-and-xyz-operations-in-d?rq=1 TODO Tag member functions in t_geom.d as pure as is done https://github.com/D-Programming-Language/phobos/blob/master/std/bigint.d TODO Remove need to use [] in x[] == y[]

See: https://www.google.se/search?q=point+plus+vector See: http://mosra.cz/blog/article.php?a=22-introducing-magnum-a-multiplatform-2d-3d-graphics-engine



auto crossProduct(T a, U b)
real distance(T a, U b)
T dotProduct(T a, U b)
bool intersect(Circle!T circle, Rect!T rect)
auto outerProduct(Vector!(Ta, Da) a, Vector!(Tb, Db) b)
auto spherePoint(Ts args)

Instantiator for SpherePoint3.

Box!(E, D) unite(Box!(E, D) a, Box!(E, D) b)

Either an element in min or max is nan or min <= max.


struct Box(E, uint D)

D-Dimensional Axis-Aligned (Hyper) Cartesian Box with Element (Component) Type E.

struct ForcedParticle(E, uint D, bool normalizedVelocityFlag = false)

D-Dimensional Particle with Coordinate Position and Direction/Velocity/Force Type (Precision) E. F = m*a; where F is force, m is mass, a is acceleration.

struct Matrix(E, uint rows_, uint cols_, Layout layout = Layout.rowMajor)

Base template for all matrix-types. Params: E = all values get stored as this type rows_ = rows of the matrix cols_ = columns of the matrix layout = matrix layout

struct Particle(E, uint D, bool normalizedVelocityFlag = false)

D-Dimensional Particle with Cartesian Coordinate position and velocity of Element (Component) Type E.

struct Plane(E, uint D)

D-Dimensional Infinite Cartesian (Hyper)-Plane with Element (Component) Type E.

struct Sphere(E, uint D)

D-Dimensional Cartesian (Hyper)-Sphere with Element (Component) Type E.

struct SpherePoint3(E)

3-Dimensional Spherical Point with Coordinate Type (Precision) E.