Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wblut.hemesh.*;
- import wblut.processing.*;
- import wblut.geom.*;
- import java.util.*;
- import peasy.*;
- HE_Mesh mesh;
- WB_Render render;
- PeasyCam cam;
- List<WB_Segment> contour = new ArrayList<WB_Segment>();
- WB_Plane pln = new WB_Plane(0, 0, 0, 0, 0, 1);
- void setup() {
- size(500, 900, P3D);
- //cam = new PeasyCam(this, 500);
- render = new WB_Render(this);
- ortho();
- createMesh();
- pln = new WB_Plane(0, 0, plnZ, 0, 0, 1);
- }
- void draw() {
- background(0);
- contour = HET_Contours.contours(mesh, pln);
- stroke(255);
- strokeWeight(10);
- strokeJoin(ROUND);
- strokeCap(ROUND);
- render.drawSegment(contour);
- //noStroke();
- //render.drawFaces(mesh);
- //strokeWeight(1);
- //stroke(0);
- //render.drawEdges(mesh);
- }
- void createMesh() {
- HEC_Creator creator = new HEC_FromOBJFile("C:/Users/it/Desktop/vanaVenturi.obj");
- mesh = new HE_Mesh(creator);
- mesh.scaleSelf(0.7);
- mesh.moveToSelf(meshLoc);
- }
- float plnZ = -20;
- void keyPressed() {
- if (key == 'w') {
- plnZ--;
- pln = new WB_Plane(0, 0, plnZ, 0, 0, 1);
- }
- if (key == 's') {
- plnZ++;
- pln = new WB_Plane(0, 0, plnZ, 0, 0, 1);
- }
- if (key == 'a') {
- mesh.scaleSelf(1.1);
- }
- if (key == 'd') {
- mesh.scaleSelf(0.9);
- }
- }
- WB_Vector meshLoc = new WB_Vector(width/2, height/2, 0);
- void mouseDragged() {
- if (mouseButton == RIGHT) {
- WB_Vector mouse = new WB_Vector(mouseX-width/2, mouseY-height/2, 0);
- WB_Vector pmouse = new WB_Vector(pmouseX-width/2, pmouseY-height/2, 0);
- WB_Vector diff = WB_Vector.sub(mouse, pmouse);
- meshLoc.addSelf(diff);
- mesh.moveToSelf(meshLoc);
- }
- if (mouseButton == LEFT) {
- WB_Vector mouse = new WB_Vector(mouseX-width/2, mouseY-height/2, 0);
- WB_Vector pmouse = new WB_Vector(pmouseX-width/2, pmouseY-height/2, 0);
- WB_Vector diff = WB_Vector.sub(mouse, pmouse);
- mesh.rotateAboutCenterSelf(diff.getLength()*0.001, diff);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement