Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Doubles_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# toxiclibs
Official master repo (Git version)

Worked up versions of the files in
toxi.geom
toxi.geom.mesh
toxi.geom.mesh2d
test
which are based on doubles.
Needed this for my own puropses, as I am developing a CNC machine with 30 meter scale, and 0.01mm resolution.

Tactic was to make a new double based class for each of the current toxicLib classes.
Appended D to the class name where it was just a word ie
SphereD vs Sphere
Where the current class defined dimensionality, put the D preceeding the dimensionality ie
VecD3D vs Vec3D

Some few of the existing classes have new double methods inserted as they were allready of mixed precisions.
These include
toxi.math.MathUtils as only a double version of random and EPSD for a double epsilon
STLReader no double version is appropriate, as STL has only 32bit numbers
STLWriter convert any incomming double classes to floats before writing.
Matrix The existing 3 flavors are mixed mode, no changes made.
GMatrix is mixed mode, no changes made.

For those classes which have constructors from self-same classes, and which have constructors from more primitive types, included cross
precision constructors, and a file in test for same.
These classes are:
AABB AABBD
Circle CircleD
Quaternion QuaternionD
Sphere SphereD
Vec2D Vec3D
Vec4D VecD2D
VecD3D VecD4D
18 changes: 16 additions & 2 deletions src.core/toxi/geom/AABB.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ public AABB() {
public AABB(AABB box) {
this(box, box.getExtent());
}

/**
* Creates an independent copy of the passed in boxD
*
* @param box
*/
public AABB(AABBD boxd) {
this(new Vec3D((float)boxd.x,(float)boxd.y,(float)boxd.z),new Vec3D(boxd.getExtent()));
System.out.println("min="+min+" max="+max);
}

/**
* Creates a new box of the given size at the world origin.
Expand Down Expand Up @@ -559,8 +569,12 @@ public Mesh3D toMesh(Mesh3D mesh) {
*/
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("<aabb> pos: ").append(super.toString()).append(" ext: ")
.append(extent);
//sb.append("<aabb> pos: ").append(super.toString()).append(" ext: ").append(extent);
sb.append( "<aabb> pos: ").append(super.toString())
.append("\n ext: ").append(extent)
.append("\n min: ").append(getMin())
.append("\n max: ").append(getMax())
;
return sb.toString();
}

Expand Down
Loading