Package toxi.geom

Examples of toxi.geom.AABB


        gfx.box(physics.getWorldBounds());
        physics.update();
        for (Iterator<VerletParticle3D> i = physics.particles.iterator(); i
                .hasNext();) {
            VerletParticle3D p = i.next();
            gfx.box(new AABB(p, 5));
        }
    }
View Full Code Here


    public void setup() {
        size(1024, 576, OPENGL);
        gfx = new ToxiclibsSupport(this);
        physics = new VerletPhysics3D();
        physics.setDrag(0.15f);
        physics.setWorldBounds(new AABB(new Vec3D(), 250));
        physics.addBehavior(new GravityBehavior3D(new Vec3D(0, 0.2f, 0)));
        physics.addBehavior(new AttractionBehavior3D(new Vec3D(), 500, 0.1f));
        for (int i = 0; i < NUM_PARTICLES; i++) {
            VerletParticle3D p = new VerletParticle3D(random(-250, 250), random(
                    -250, 250), random(-250, 250));
View Full Code Here

    public VolumetricSpace voxelizeMesh(Mesh3D mesh) {
        return voxelizeMesh(mesh, 1f);
    }

    public VolumetricSpace voxelizeMesh(Mesh3D mesh, float iso) {
        AABB box = mesh.getBoundingBox();
        Vec3D bmin = box.getMin();
        Vec3D bmax = box.getMax();
        ScaleMap wx = new ScaleMap(bmin.x, bmax.x, 1, volume.resX - 2);
        ScaleMap wy = new ScaleMap(bmin.y, bmax.y, 1, volume.resY - 2);
        ScaleMap wz = new ScaleMap(bmin.z, bmax.z, 1, volume.resZ - 2);
        ScaleMap gx = new ScaleMap(1, volume.resX - 2, bmin.x, bmax.x);
        ScaleMap gy = new ScaleMap(1, volume.resY - 2, bmin.y, bmax.y);
        ScaleMap gz = new ScaleMap(1, volume.resZ - 2, bmin.z, bmax.z);
        volume.setScale(box.getExtent().scale(2f));
        Triangle3D tri = new Triangle3D();
        AABB voxel = new AABB(new Vec3D(), volume.voxelSize.scale(0.5f));
        for (Face f : mesh.getFaces()) {
            tri.a = f.a;
            tri.b = f.b;
            tri.c = f.c;
            AABB bounds = tri.getBoundingBox();
            Vec3D min = bounds.getMin();
            Vec3D max = bounds.getMax();
            min = new Vec3D((int) wx.getClippedValueFor(min.x),
                    (int) wy.getClippedValueFor(min.y),
                    (int) wz.getClippedValueFor(min.z));
            max = new Vec3D((int) wx.getClippedValueFor(max.x),
                    (int) wy.getClippedValueFor(max.y),
View Full Code Here

    }

    private static void save() {
        try {
            JAXBGeomTest test = new JAXBGeomTest();
            test.box = new AABB();
            test.plane = new Plane();
            test.quat = new Quaternion(0, Vec3D.X_AXIS);
            test.ray = new Ray3D();
            test.rect = new Rect(0, 0, 100, 200);
            test.sphere = new Sphere();
View Full Code Here

TOP

Related Classes of toxi.geom.AABB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.