00001 package edu.tum.cs.ias.knowrob.vis.items; 00002 00003 import javax.vecmath.Matrix4d; 00004 import javax.vecmath.Vector3d; 00005 00006 import edu.tum.cs.ias.knowrob.vis.Canvas; 00007 00008 public class Sphere extends Handle { 00009 00010 00011 private float radius; 00012 00013 public Sphere(float m00, float m01, float m02, float m03, float m10, 00014 float m11, float m12, float m13, float m20, float m21, float m22, 00015 float m23, float m30, float m31, float m32, float m33, float xdim, 00016 float ydim, float zdim) { 00017 00018 super(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, 00019 m32, m33, xdim, ydim, zdim); 00020 this.radius=(float) (0.5 * Math.sqrt(xdim*xdim + ydim*ydim + zdim*zdim)); 00021 } 00022 00023 public Sphere(Matrix4d pose, Vector3d dim){ 00024 super(pose, dim); 00025 this.radius=(float) (0.5 * Math.sqrt(xdim*xdim + ydim*ydim + zdim*zdim)); 00026 } 00027 00028 00029 public Sphere(float x, float y, float z, float radius, int color) { 00030 00031 super(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1, radius, radius, radius); 00032 this.radius = radius; 00033 this.color = color; 00034 } 00035 00036 @Override 00037 public void drawIt(Canvas c) { 00038 00039 c.sphere(radius); 00040 } 00041 } 00042