本文整理汇总了Java中math.geom3d.Shape3D类的典型用法代码示例。如果您正苦于以下问题:Java Shape3D类的具体用法?Java Shape3D怎么用?Java Shape3D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Shape3D类属于math.geom3d包,在下文中一共展示了Shape3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPlaneIntersectionParametric
import math.geom3d.Shape3D; //导入依赖的package包/类
/** Compute intersection with a plane
*
* @param plane plane to compute intersection with
* @return parametric representation of the intersection or NaN
*/
public double getPlaneIntersectionParametric(Plane3D plane) {
// the plane normal
Vector3D planeNormal = plane.getNormalVector();
double normalLineDot = Vector3D.dotProduct(planeNormal, getVector());
if ( Math.abs(normalLineDot) < Shape3D.ACCURACY ) {
// right angle between plane normal and line vector => line is parallel to the plane
return Double.NaN;
}
// the difference between origin of plane and origin of line
Vector3D dp = new Vector3D(getOrigin(), plane.getOrigin());
// compute ratio of dot products,
return Vector3D.dotProduct(planeNormal, dp) / normalLineDot;
}
示例2: getBoundingBox
import math.geom3d.Shape3D; //导入依赖的package包/类
@Override
public Box3D getBoundingBox() {
// plane parallel to XY plane
if (Math.abs(vector1.getZ())<Shape3D.ACCURACY&&Math.abs(vector2.getZ())<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
origin.getZ(), origin.getZ());
// plane parallel to YZ plane
if (Math.abs(vector1.getX())<Shape3D.ACCURACY&&Math.abs(vector2.getX())<Shape3D.ACCURACY)
return new Box3D(origin.getX(), origin.getX(),
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
// plane parallel to XZ plane
if (Math.abs(vector1.getY())<Shape3D.ACCURACY&&Math.abs(vector2.getY())<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
origin.getY(), origin.getY(),
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
return new Box3D(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
}
示例3: boundingBox
import math.geom3d.Shape3D; //导入依赖的package包/类
public Box3D boundingBox() {
Vector3D v = this.direction();
// line parallel to (Ox) axis
if (Math.hypot(v.getY(), v.getZ())<Shape3D.ACCURACY)
return new Box3D(x0, x0, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY);
// line parallel to (Oy) axis
if (Math.hypot(v.getX(), v.getZ())<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, y0, y0, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY);
// line parallel to (Oz) axis
if (Math.hypot(v.getX(), v.getY())<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, z0, z0);
return new Box3D(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
}
示例4: boundingBox
import math.geom3d.Shape3D; //导入依赖的package包/类
public Box3D boundingBox() {
// plane parallel to XY plane
if (Math.abs(dz1)<Shape3D.ACCURACY&&Math.abs(dz2)<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, z0, z0);
// plane parallel to YZ plane
if (Math.abs(dx1)<Shape3D.ACCURACY&&Math.abs(dx2)<Shape3D.ACCURACY)
return new Box3D(x0, x0, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY);
// plane parallel to XZ plane
if (Math.abs(dy1)<Shape3D.ACCURACY&&Math.abs(dy2)<Shape3D.ACCURACY)
return new Box3D(Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY, y0, y0, Double.NEGATIVE_INFINITY,
Double.POSITIVE_INFINITY);
return new Box3D(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
}
示例5: equals
import math.geom3d.Shape3D; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Plane3D))
return false;
Plane3D plane = (Plane3D) obj;
if (Math.abs(this.x0-plane.x0)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.y0-plane.y0)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.z0-plane.z0)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dx1-plane.dx1)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dy1-plane.dy1)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dz1-plane.dz1)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dx2-plane.dx2)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dy2-plane.dy2)>Shape3D.ACCURACY)
return false;
if (Math.abs(this.dz2-plane.dz2)>Shape3D.ACCURACY)
return false;
return true;
}
示例6: equals
import math.geom3d.Shape3D; //导入依赖的package包/类
/**
* Compares two transforms. Returns true if all inner fields are equal up to
* the precision given by Shape3D.ACCURACY.
*/
@Override
public boolean equals(Object other) {
if (other instanceof AffineTransform3D) {
Matrix4d otherMatrix = ((AffineTransform3D) other).matrix;
return (
Math.abs(matrix.m00 - otherMatrix.m00)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m01 - otherMatrix.m01)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m02 - otherMatrix.m02)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m03 - otherMatrix.m03)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m10 - otherMatrix.m10)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m11 - otherMatrix.m11)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m12 - otherMatrix.m12)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m13 - otherMatrix.m13)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m20 - otherMatrix.m20)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m21 - otherMatrix.m21)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m22 - otherMatrix.m22)<= Shape3D.ACCURACY
&&
Math.abs(matrix.m23 - otherMatrix.m23)<= Shape3D.ACCURACY
// rest should be ( 0, 0, 0, 1 ) in both matrices
);
} else {
return false;
}
}
示例7: contains
import math.geom3d.Shape3D; //导入依赖的package包/类
public boolean contains(Point3D point) {
StraightLine3D line = this.getSupportingLine();
if (!line.contains(point))
return false;
double t = line.getPosition(point);
if (t<-Shape3D.ACCURACY)
return false;
if (t>1+Shape3D.ACCURACY)
return false;
return true;
}
示例8: getBoundingBox
import math.geom3d.Shape3D; //导入依赖的package包/类
@Override
public Box3D getBoundingBox() {
Vector3D v = this.getVector();
// line parallel to (Ox) axis
if (JavaGeomMath.hypot(v.getY(), v.getZ())<Shape3D.ACCURACY)
return new Box3D(
origin.getX(), origin.getX(),
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY
);
// line parallel to (Oy) axis
if (JavaGeomMath.hypot(v.getX(), v.getZ())<Shape3D.ACCURACY)
return new Box3D(
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
origin.getY(), origin.getY(),
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY
);
// line parallel to (Oz) axis
if (JavaGeomMath.hypot(v.getX(), v.getY())<Shape3D.ACCURACY)
return new Box3D(
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
origin.getZ(), origin.getZ()
);
return new Box3D(
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY
);
}
示例9: getLineIntersectionParametric
import math.geom3d.Shape3D; //导入依赖的package包/类
/** Compute intersection of a line with this plane.
*
* @param line line to compute intersection with
* @return parametric representation of the intersection in respect to the line or NaN if the line is parallel
*/
public double getLineIntersectionParametric( StraightLine3D line ) {
double distance = origin-getAxisCoord(line.getOrigin());
double directionInverse = getAxisCoord(line.getVectorInverse());
if ( directionInverse > Shape3D.ACCURACY_INVERSE ) {
return Double.NaN;
}
return distance*directionInverse;
}
示例10: transform
import math.geom3d.Shape3D; //导入依赖的package包/类
@Override
public Shape3D transform(AffineTransform3D trans) {
return new Plane3D(
this.getOrigin().transform(trans),
this.getVector1().transform(trans),
this.getVector2().transform(trans)
);
}
示例11: equals
import math.geom3d.Shape3D; //导入依赖的package包/类
/**
* Compares two transforms. Returns true if all inner fields are equal up to
* the precision given by Shape3D.ACCURACY.
*/
@Override
public boolean equals(Object obj) {
if (!(obj instanceof AffineTransform3D))
return false;
double tab[] = ((AffineTransform3D) obj).coefficients();
if (Math.abs(tab[0] - m00) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[1] - m01) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[2] - m02) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[3] - m03) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[4] - m10) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[5] - m11) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[6] - m12) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[7] - m13) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[8] - m20) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[9] - m21) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[10] - m22) > Shape3D.ACCURACY)
return false;
if (Math.abs(tab[11] - m23) > Shape3D.ACCURACY)
return false;
return true;
}
示例12: contains
import math.geom3d.Shape3D; //导入依赖的package包/类
public boolean contains(Point3D point) {
StraightLine3D line = this.supportingLine();
if (!line.contains(point))
return false;
double t = line.position(point);
if (t<-Shape3D.ACCURACY)
return false;
if (t>1+Shape3D.ACCURACY)
return false;
return true;
}
示例13: transform
import math.geom3d.Shape3D; //导入依赖的package包/类
/**
* @deprecated shapes are responsible of their transform (0.6.3)
*/
@Deprecated
public Shape3D transform(Shape3D shape) {
return shape.transform(this);
}
示例14: clip
import math.geom3d.Shape3D; //导入依赖的package包/类
public Shape3D clip(Box3D box) {
// TODO Auto-generated method stub
return null;
}
示例15: clip
import math.geom3d.Shape3D; //导入依赖的package包/类
@Override
public Shape3D clip(Box3D box) {
// TODO Auto-generated method stub
return null;
}