Java 类javax.vecmath.Point4d 实例源码
项目:java-membership-protocol
文件:Hyperbolizer.java
public void mouseDragged(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
float diffX = (float)(x - prevMouseX);
float diffY = (float)(y - prevMouseY);
if (mouseRDown)
{
rendu.rotateY(diffX / 100);
rendu.rotateX(diffY / 100);
}
if (mouseLDown)
{
rendu.translate(Espace.ORIGIN4, new Point4d((x - 620)*0.002, 0.0, 0.0, 1.0));
}
prevMouseX = x;
prevMouseY = y;
}
项目:java-membership-protocol
文件:Hypership.java
public void mouseDragged(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
float diffX = (float)(x - prevMouseX);
float diffY = (float)(y - prevMouseY);
if (mouseRDown)
{
rendu.rotateY(diffX / 100);
rendu.rotateX(diffY / 100);
}
if (mouseLDown)
{
rendu.translate(Espace.ORIGIN4, new Point4d((x - 620)*0.002, 0.0, 0.0, 1.0));
}
prevMouseX = x;
prevMouseY = y;
}
项目:jtem-halfedgetools
文件:SurfaceUtility.java
public static
<
V extends Vertex<V, E, F> & HasXYZW,
E extends Edge<V, E, F>,
F extends Face<V, E, F>
> double[][] getBBox(HalfEdgeDataStructure<V, E, F> surface) {
double result[][] = new double[2][3];
Point4d p0 = surface.getVertex(0).getXYZW();
VecmathTools.dehomogenize(p0);
result[0] = new double[]{p0.x, p0.y, p0.z};
result[1] = result[0].clone();
for (int i=1; i< surface.numVertices(); i++) {
Point4d p = surface.getVertex(i).getXYZW();
VecmathTools.dehomogenize(p);
if ( result[0][0] > p.x ) result[0][0] = p.x;
if ( result[1][0] < p.x ) result[1][0]= p.x;
if ( result[0][1] > p.y ) result[0][1] = p.y;
if ( result[1][1] < p.y ) result[1][1]= p.y;
if ( result[0][2] > p.z ) result[0][2] = p.z;
if ( result[1][2] < p.z ) result[1][2]= p.z;
}
return result;
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static double distFromPointToLine(Point4d x0, Point4d x1, Point4d x2) {
Point3d
v = p4top3(x0),
l = p4top3(x1),
r = p4top3(x2);
// calculate |v|, that is, the distance from the coordinate
// v to the line (l, r)
// |(r - l) x (l - v) |
// this is given by |v| = -----------------------
// |(r - l)|
// where a,b are points of the line and c the point to measure
// TODO can get rid of sqrt if we want, but it is no big deal
Vector3d rl = new Vector3d();
rl.sub(r, l);
Vector3d lv = new Vector3d();
lv.sub(l, v);
Vector3d temp = new Vector3d();
temp.cross(rl, lv);
double dist = temp.length()/rl.length();
return dist;
}
项目:java-membership-protocol
文件:AnimatedTranslation.java
public AnimatedTranslation(double d, Point4d pS, Point4d pE, Rendu r)
{
super(d);
pStart = new Point4d(pS);
pEnd = new Point4d(pE);
pCurrent = new Point4d(pS);
oCurrent = new Point4d();
rendu = r;
}
项目:java-membership-protocol
文件:Rendu.java
public void translate(Point4d a, Point4d b)
{
Matrix4d t = EspaceHyperbolique.translate(a, b);
for (Objet o : listeObjets)
o.applyTransform(t);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static void projectInverseStereographic(Point2d p2d, Point4d p4d, double scale) {
double x = p2d.x / scale;
double y = p2d.y / scale;
double nx = 2 * x;
double ny = x*x + y*y - 1;
double nz = 2 * y;
double nw = ny + 2;
p4d.set(nx, ny, nz, nw);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static Point4d cross(Point4d p1, Point4d p2){
dehomogenize(p1);
dehomogenize(p2);
Point4d result = new Point4d();
result.x = p1.y * p2.z - p1.z * p2.y;
result.y = p1.z * p2.x - p1.x * p2.z;
result.z = p1.x * p2.y - p1.y * p2.x;
result.w = 1.0;
return result;
}
项目:j3d-core
文件:SceneGraphPath.java
final void setIntersectPointDis( Point4d pickLocation ) {
// System.err.println( "setIntersectPointDis pickLocation= "+pickLocation);
intersectPoint.x = pickLocation.x;
intersectPoint.y = pickLocation.y;
intersectPoint.z = pickLocation.z;
pickDistance = pickLocation.w;
}
项目:j3d-core
文件:BHTree.java
private void doSelect(PickShape pickShape, UnorderList hitArrList,
BHNode bh, Point4d pickPos) {
if ((bh == null) || (bh.bHull.isEmpty())) {
return;
}
switch(bh.nodeType) {
case BHNode.BH_TYPE_LEAF:
if (((BHLeafNode)(bh)).isEnable() &&
(((BHLeafNode) bh).leafIF instanceof GeometryAtom) &&
((GeometryAtom) (((BHLeafNode)
bh).leafIF)).source.isPickable &&
pickShape.intersect(bh.bHull, pickPos)) {
hitArrList.add(bh);
}
break;
case BHNode.BH_TYPE_INTERNAL:
if (pickShape.intersect(bh.bHull, pickPos)) {
doSelect(pickShape,
hitArrList,
((BHInternalNode)bh).getRightChild(),
pickPos);
doSelect(pickShape,
hitArrList,
((BHInternalNode)bh).getLeftChild(),
pickPos);
}
break;
}
}
项目:j3d-core
文件:BHTree.java
private BHNode doSelectAny(PickShape pickShape, BHNode bh, Point4d pickPos) {
BHNode hitNode = null;
if((bh == null) || (bh.bHull.isEmpty()))
return null;
switch(bh.nodeType) {
case BHNode.BH_TYPE_LEAF:
if (((BHLeafNode)(bh)).isEnable() &&
(((BHLeafNode) bh).leafIF instanceof GeometryAtom) &&
((GeometryAtom) (((BHLeafNode)
bh).leafIF)).source.isPickable &&
pickShape.intersect(bh.bHull, pickPos)) {
return bh;
}
break;
case BHNode.BH_TYPE_INTERNAL:
if (pickShape.intersect(bh.bHull, pickPos)) {
hitNode = doSelectAny(pickShape,
((BHInternalNode)bh).getRightChild(),
pickPos);
if (hitNode != null) {
return hitNode;
}
return doSelectAny(pickShape,
((BHInternalNode)bh).getLeftChild(),
pickPos);
}
break;
}
return null;
}
项目:java-membership-protocol
文件:Maths.java
public static double dotProduct(Point4d x, Point4d y)
{
return (x.x*y.x + x.y*y.y + x.z*y.z) / (x.w * y.w);
}
项目:java-membership-protocol
文件:Maths.java
public static double minkowski(Point4d x, Point4d y)
{
return x.x*y.x + x.y*y.y + x.z*y.z - x.w*y.w;
}
项目:java-membership-protocol
文件:Point.java
public void setCoord4d(Point4d p) {
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static void dehomogenize(Point4d p){
p.x /= p.w;
p.y /= p.w;
p.z /= p.w;
p.w = 1.0;
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static void normalize(Point4d p){
p.scale(1 / p.distance(zero4d));
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static double length(Point4d p){
dehomogenize(p);
return p.distance(zero4d);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static double distance(Point4d p1, Point4d p2) {
dehomogenize(p1); dehomogenize(p2);
return Math.sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y) + (p1.z - p2.z)*(p1.z - p2.z));
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static void sphereMirror(Point4d p){
VecmathTools.dehomogenize(p);
double lengthSqr = (p.x*p.x + p.y*p.y + p.z*p.z);
p.w = lengthSqr;
VecmathTools.dehomogenize(p);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static boolean isNAN(Point4d p){
return isNaN(p.x) || isNaN(p.y) || isNaN(p.z) || isNaN(p.w);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static Point3d p4top3(Point4d p) {
Point4d t = new Point4d(p);
dehomogenize(t);
return new Point3d(t.x, t.y, t.z);
}
项目:jtem-halfedgetools
文件:VecmathTools.java
public static Vector3d p4tov3(Point4d p) {
Point4d t = new Point4d(p);
dehomogenize(t);
return new Vector3d(t.x, t.y, t.z);
}
项目:breakout
文件:VecmathUtils.java
public static Point3d toPoint3d(Point4d p) {
return new Point3d(p.x, p.y, p.z);
}
项目:breakout
文件:VecmathUtils.java
public static Point3f toPoint3f(Point4d p) {
return new Point3f((float) p.x, (float) p.y, (float) p.z);
}
项目:breakout
文件:VecmathUtils.java
public static Point4d toPoint4d(Point3d p, double w) {
return new Point4d(p.x, p.y, p.z, w);
}
项目:java-membership-protocol
文件:AnimatedCube.java
public void setCoord4d(Point4d p)
{
}
项目:j3d-core
文件:PickShape.java
/**
* Return true if shape intersect with bounds.
* The point of intersection is stored in pickPos.
*/
abstract boolean intersect(Bounds bounds, Point4d pickPos);
项目:java-membership-protocol
文件:AnimatedTranslation.java
public void setCoord4d(Point4d p) {}
项目:jtem-halfedgetools
文件:HasXYZW.java
public Point4d getXYZW();
项目:jtem-halfedgetools
文件:HasXYZW.java
public void setXYZW(Point4d p);