======================
LOOK! LICENSING TERMS
======================
look! is licensed under the BSD 3-Clause (also known as "BSD New" or
"BSD Simplified"), as follows:
Copyright (c) 2010-2012, Look...
If you think the Android project Look listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
*-----------------------------------------------------------------------------
* Copyright (c) 2012, Look! Development Team
* All rights reserved.//fromwww.java2s.com
*
* Distributed under the terms of the BSD Simplified License.
*
* The full license is in the LICENSE file, distributed with this software.
*-----------------------------------------------------------------------------
*/package es.ucm.look.ar.math.geom;
/**
* Represents a geometric ray, compound of a {@link Point3} and a
* {@link Vector3}
*
* @author ??ngel Serrano
*
*/publicclass Ray {
private Point3 point;
private Vector3 vector;
/**
* Constructs a ray from a point and a vector
*
* @param p
* the point
* @param v
* the vector
*/public Ray(Point3 p, Vector3 v) {
this.point = p;
this.vector = v;
}
/**
* Returns the point in the ray that corresponds to the given t parameter
*
* @param t
* t parameter
* @return the corresponding point
*/public Point3 getPoint(float t) {
Point3 p = new Point3(t * vector.x, t * vector.y, t * vector.z);
p.add(point);
return p;
}
/**
* Returns the starting point for this ray
*
* @return the starting point for this ray
*/public Point3 getPoint() {
return point;
}
/**
* Returns the vector defining the ray
*
* @return the vector defining the ray
*/public Vector3 getVector() {
return vector;
}
publicvoid setVector(float x, float y, float z){
this.vector.set(x, y, z);
}
privatestatic Ray r = new Ray( new Point3( 0, 0, 0 ), new Vector3( 0, 0, 0 ));
publicstatic Ray getVolatileRay( Point3 p, Vector3 v ){
r.point = p;
r.vector = v;
return r;
}
}