本文整理匯總了Java中javax.vecmath.Point3d類的典型用法代碼示例。如果您正苦於以下問題:Java Point3d類的具體用法?Java Point3d怎麽用?Java Point3d使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Point3d類屬於javax.vecmath包,在下文中一共展示了Point3d類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: create3D
import javax.vecmath.Point3d; //導入依賴的package包/類
/** Create 3D geometry. */
@Override
protected void create3D() {
Appearance appear = new Appearance();
material.setCapability(Material.ALLOW_COMPONENT_WRITE);
material.setDiffuseColor(color);
material.setSpecularColor(black);
appear.setMaterial(material);
int flags = Primitive.GEOMETRY_NOT_SHARED | Primitive.ENABLE_GEOMETRY_PICKING | Primitive.GENERATE_NORMALS;
body = new Sphere(radius, flags, appear);
// we must be able to change the pick flag of the agent
body.setCapability(Node.ALLOW_PICKABLE_READ);
body.setCapability(Node.ALLOW_PICKABLE_WRITE);
body.setPickable(true);
body.setCollidable(true);
addChild(body);
// Add bounds for interactions
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
setBounds(bounds);
}
示例2: getNearestNavPoint
import javax.vecmath.Point3d; //導入依賴的package包/類
public NavPoint getNearestNavPoint(SPLocation location) {
// TODO: implement using oct-trees
Point3d loc = location.asPoint3d();
double nearestDistance = Double.MAX_VALUE;
NavPoint nearest = null;
for (NavPoint navPoint : getNavPoints()) {
try{
double distance = loc.distance(navPoint.getLocation().getPoint3d());
if (distance < nearestDistance) {
nearestDistance = distance;
nearest = navPoint;
}
}catch(NullPointerException npe){
}
}
return nearest;
}
示例3: createBlocks
import javax.vecmath.Point3d; //導入依賴的package包/類
private void createBlocks( Closer<Point3d> closer, LoopL<Point3d> polies ) {
Map<Point3d, Integer> bMap = closer.findMap();
if (TweedSettings.settings.snapFootprintVert > 0) {
Loopz.dirtySnap(polies, TweedSettings.settings.snapFootprintVert);
}
for ( Loop<Point3d> poly : polies)
if (poly.count() > 0) {
int key = bMap.get ( poly.start.get() );
LoopL<Point3d> loopl = blocks.get(key);
if (loopl == null)
blocks.put(key, loopl = new LoopL<>() );
if (TweedSettings.settings.calculateFootprintNormals) {
if (Loopz.area( Loopz.to2dLoop( poly, 1, null ) ) < 0)
poly.reverse();
}
loopl.add(poly);
}
}
示例4: buildProfile
import javax.vecmath.Point3d; //導入依賴的package包/類
public static Prof buildProfile( Line3d oLine, Point3d cen ) {
Matrix4d to2D = new Matrix4d();
Vector3d c2 = oLine.dir(), c3 = new Vector3d();
c2.normalize();
c3.cross( c2, UP );
to2D.setIdentity();
to2D.setRow( 0, c3.x, c3.y, c3.z, 0 );
to2D.setRow( 1, UP.x, UP.y, UP.z, 0 );
to2D.setRow( 2, c2.x, c2.y, c2.z, 0 );
{
Point3d start = new Point3d( cen.x, 0, cen.z );
to2D.transform( start );
to2D.m03 = -start.x;
to2D.m13 = -start.y;
to2D.m23 = -start.z;
to2D.m33 = 1;
}
Prof monotonic = new Prof(to2D, c2);
return monotonic;
}
示例5: at3DHeight
import javax.vecmath.Point3d; //導入依賴的package包/類
public Point3d at3DHeight( double h3 ) {
double h = to2d (new Point3d(0,h3,0) ).y;
int i = 0;
while (get(i).y <= h && i < size() - 1)
i++;
if (i == 0)
return null;
else if (get(i).y <= h)
return null;
else
return to3d( new Point2d( new Line(get(i-1), get(i)).xAtY( h ), h ) );
}
示例6: inBounds
import javax.vecmath.Point3d; //導入依賴的package包/類
private boolean inBounds( Matrix4d mini, List<double[]> bounds ) {
// mini matrix is in mini-mesh format: a translation from a 255^3 cube in the first quadrant
// trans.offset is a transform from that space, into jme rendered space (cartesian in meters, around the origin)
Matrix4d m = new Matrix4d();
m.mul( Jme3z.fromMatrix ( trans.offset ), mini );
for (Point2d p : Arrays.stream( cubeCorners ).map( c -> {
Point3d tmp = new Point3d();
m.transform( c, tmp );
return new Point2d(tmp.x, tmp.z);
}).collect( Collectors.toList() ) ) {
for (double[] bound : bounds) {
if (
bound[0] < p.x && bound[1] > p.x &&
bound[2] < p.y && bound[3] > p.y )
return true;
}
}
return false;
}
示例7: blockSelected
import javax.vecmath.Point3d; //導入依賴的package包/類
@Override
public void blockSelected( LoopL<Point3d> polies, BlockGen blockGen ) {
Point2d cen = Loopz.average( Loopz.to2dLoop( polies, 1, null ) );
for (File f : new File (tweed.DATA+File.separator +"solutions").listFiles()) {
try {
Point2d fp = FeatureCache.fileToCenter( f.getName() );
if (fp.distanceSquared( cen ) < 1) {
new Thread( () -> load( f, true ) ).start();
return;
}
}
catch (Throwable th) {
System.out.println( "unable to read solution "+f.getName() );
}
}
JOptionPane.showMessageDialog( tweed.frame(), "Can't find solution for center " + cen );
}
示例8: order
import javax.vecmath.Point3d; //導入依賴的package包/類
private static boolean order( Face a, Face b ) {
Point3d ap = a.definingSE.iterator().next().getStart( a );
Point3d bp = b.definingSE.iterator().next().getStart(b);
if (ap == null || bp == null)
return true; //?!
if (ap.x < bp.x)
return true;
if (ap.x > bp.x)
return false;
if (ap.y < bp.y)
return true;
if (ap.y > bp.y)
return false;
return false;
}
示例9: worldToLLong
import javax.vecmath.Point3d; //導入依賴的package包/類
public static Point2d worldToLLong( Tweed tweed, Point3d cen ) {
Point3d out = new Point3d( cen );
TweedSettings.settings.fromOrigin.transform( out );
try {
double[] latLong = new double[3];
toLatLong.transform( new double[] { out.x, out.y, out.z }, 0, latLong, 0, 1 );
return new Point2d( latLong[ 0 ], latLong[ 1 ] );
} catch ( TransformException e ) {
e.printStackTrace();
}
return null;
}
示例10: interpolateFP
import javax.vecmath.Point3d; //導入依賴的package包/類
private Point3d interpolateFP(Point2d point) {
double minDistance = Double.POSITIVE_INFINITY;
Point3d nearestPoint = new Point3d();
for (Point3d midlinePoint : midlinePoints) {
double distance = point.distance(new Point2d(midlinePoint.y, midlinePoint.z));
if (distance < minDistance) {
minDistance = distance;
nearestPoint = midlinePoint;
if (distance == 0.d) {
break;
}
}
}
return nearestPoint;
}
示例11: getImageCoord
import javax.vecmath.Point3d; //導入依賴的package包/類
public float[] getImageCoord(Point3d p) {
int nearestIndex = 0;
int indexCounter = 0;
double minDistance = Double.POSITIVE_INFINITY;
for (Vector3f vert : verts) {
double distance = new Point3d(p).distance(new Point3d(vert));
if (distance < minDistance) {
minDistance = distance;
nearestIndex = indexCounter;
if (distance == 0) {
break;
}
}
indexCounter++;
}
Vector3f coordVector = texCoords.get(vertTexMap.get(nearestIndex));
return new float[]{coordVector.x, coordVector.y};
}
示例12: getTextureFPfromModel
import javax.vecmath.Point3d; //導入依賴的package包/類
private Point getTextureFPfromModel(FacialPointType type) {
if (objFPmodel == null) {
return null;
}
FacialPoint fp = objFPmodel.getFacialPoint(type);
Point imagePoint = textureMapper.getImagePoint(new Point3d(fp.getCoords()));
imagePoint.x *= originalImage.height();
imagePoint.y = imagePoint.y;
imagePoint.y *= originalImage.width();
imagePoint.x *= resizeRatio;
imagePoint.y *= resizeRatio;
Point rotatedPoint = rotatePoint(imagePoint, 90, workingImage);
OCVutils.drawPoint(workingImage, rotatedPoint, OCVutils.GREEN);
return imagePoint;
}
示例13: getIntersectionBetweenCornerAndPlane
import javax.vecmath.Point3d; //導入依賴的package包/類
public static Corner getIntersectionBetweenCornerAndPlane(PlaneEquation planeEq, Corner corner, LinkedList<Point3d> intersectPoints, ArrayList<Vector3f> verts) {
Vector3f point1 = verts.get(corner.vertex);
Vector3f point2 = verts.get(corner.next.vertex);
Vector3f point3 = verts.get(corner.prev.vertex);
Point3d intersectPoint;
Corner intersectCorner = null;
intersectPoint = getIntersectionBetweenLineAndPlane(planeEq, point2, point3);
if (intersectPoint != null) {
intersectCorner = corner.next;
} else {
intersectPoint = getIntersectionBetweenLineAndPlane(planeEq, point3, point1);
if (intersectPoint != null) {
intersectCorner = corner.prev;
}
}
if (intersectPoint != null) {
intersectPoints.add(intersectPoint);
}
return intersectCorner;
}
示例14: zoomOn
import javax.vecmath.Point3d; //導入依賴的package包/類
/**
* Permet de déplacer de manière à centrer sur le point P(x y z )
* @param x
* @param y
* @param z
* @param direction
* Il s'agit de la direction dans laquelle est regardée le
* point. La caméra se trouvera à la translation vecteur appliqué à P
* La norme du vecteur indique la distance entre la caméra et le
* point
*/
public void zoomOn(double x, double y, double z, Vecteur direction) {
Transform3D viewTrans = new Transform3D();
if (direction == null) {
return;
}
if (direction.norme() == 0) {
return;
}
// point the view at the center of the object
Point3d center = new Point3d(x + this.translate.x, y + this.translate.y, z + this.translate.z);
Point3d eyePos = new Point3d(x + this.translate.x + direction.getX(), y + this.translate.y
+ direction.getY(), z + this.translate.z + direction.getZ());
viewTrans.setIdentity();
viewTrans.lookAt(eyePos, center, new Vector3d(0, 0, 1));
// set the view transform
viewTrans.invert();
InterfaceMap3D.tgvu.setTransform(viewTrans);
}
示例15: getCaAtoms
import javax.vecmath.Point3d; //導入依賴的package包/類
/**
* Gets the C-alpha {@link Atom} for the given input {@link Segment}.
* @param segment the input {@link Segment} object
* @return the C-alpha array of {@link Atom} objects
*/
public static Atom[] getCaAtoms(Segment segment) {
Point3d[] points = segment.getCoordinates();
Chain chain = new ChainImpl();
chain.setId(CHAIN_NAME);
chain.setName(CHAIN_NAME);
Atom[] atoms = new Atom[points.length];
for (int i = 0, j = 0; i < points.length; i++) {
if (points[i] != null) {
atoms[j] = new AtomImpl();
atoms[j].setName(CA_NAME);
Group group = new AminoAcidImpl();
group.setPDBName("GLU");
group.addAtom(atoms[j]);
group.setChain(chain);
group.setResidueNumber(new ResidueNumber(CHAIN_NAME, j, '\0'));
atoms[j].setX(points[i].x);
atoms[j].setY(points[i].y);
atoms[j].setZ(points[i].z);
j++;
}
}
return atoms;
}