[toxiclibs] import 3D object

edited February 2015 in Library Questions

Hi! I'm trying to import a 3d object into processing. I have the obj file (and exported in stl binary format with Rhino) and I'm trying to import it into a toxic lib triangle mesh. What I get is not What I'm expecting.

Here is my object seen in Rhino: Screen Shot 2014-05-28 at 10.27.07 AM

This is my processing code (done inside Eclipse):

import processing.core.PApplet;
import toxi.geom.Vec3D;
import toxi.geom.mesh.STLReader;
import toxi.geom.mesh.TriangleMesh;
import toxi.processing.ToxiclibsSupport;

public class Main extends PApplet {
    public static void main(String[] args) {
        PApplet.main(new String[] { "Main" });
    }

    ToxiclibsSupport gfx;
    TriangleMesh mesh;

    public void setup()
    {
        size( 800, 600, P3D);
        gfx = new ToxiclibsSupport(this);
        mesh = (TriangleMesh) new STLReader().loadBinary(
                sketchPath("bumps_deformed.stl"), STLReader.TRIANGLEMESH);
    }

    public void draw()
    {
        background(151);
        lights();
        translate(width/2, height/2, 300);
        rotateX(mouseY*0.01f);
        rotateY(mouseX*0.01f);
        gfx.origin(new Vec3D(), 100);
        noStroke();
        gfx.mesh(mesh, true, 10);
    }
}

This is what I see when I run the sketch: Screen Shot 2014-05-28 at 10.30.30 AM

Answers

Sign In or Register to comment.