Point.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.vis.items;
00002 
00003 import javax.vecmath.Vector3f;
00004 
00005 import edu.tum.cs.ias.knowrob.vis.Canvas;
00006 import edu.tum.cs.ias.knowrob.vis.Drawable;
00007 
00008 public class Point implements Drawable {
00009 
00010         public edu.tum.cs.ias.knowrob.util.datastructures.Vector3f v;
00011         public float size;
00012         public int color;
00013         
00014         public Point(float x, float y, float z, int color, float size) {
00015                 this.v = new edu.tum.cs.ias.knowrob.util.datastructures.Vector3f(x,y,z);
00016                 this.color = color;
00017                 this.size = size;
00018         }
00019         
00020         public Point(Vector3f v, int color, float size) {
00021                 this(v.x, v.y, v.z, color, size);
00022         }
00023         
00024         public Point(Point p) {
00025                 copyPos(p);
00026                 color = p.color;
00027                 size = p.size;
00028         }
00029         
00033         public void draw(Canvas c) {
00034             c.pushMatrix();
00035                 c.translate(0,0,v.z);
00036             c.noStroke(); // do not draw outline
00037             c.fill(color);          
00038             c.ellipse(v.x, v.y, size, size);
00039             c.popMatrix();
00040         }
00041         
00042         public void drawAsSphere(Canvas c) {
00043                 c.pushMatrix();
00044                 c.fill(color);
00045                 c.color(color);
00046                 c.noStroke();
00047                 c.translate(v.x,v.y,v.z);
00048                 c.sphere(size);
00049                 c.popMatrix();
00050         }
00051         
00052         @Override
00053         public String toString() {
00054                 return String.format("(%f/%f/%f)", v.x, v.y, v.z);
00055         }
00056 
00061         public void copyPos(Point p2) {
00062                 v = new edu.tum.cs.ias.knowrob.util.datastructures.Vector3f(p2.v);
00063         }       
00064 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Mon Oct 6 2014 01:30:00