本文整理匯總了Java中javax.vecmath.Point3d.add方法的典型用法代碼示例。如果您正苦於以下問題:Java Point3d.add方法的具體用法?Java Point3d.add怎麽用?Java Point3d.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.vecmath.Point3d
的用法示例。
在下文中一共展示了Point3d.add方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buisitDistanceSim
import javax.vecmath.Point3d; //導入方法依賴的package包/類
/**
* @param sensor Distanzsensor
* @param isLeft links?
* @throws IOException
*/
public void buisitDistanceSim(final Sensors.Distance sensor, boolean isLeft) throws IOException {
final double MAX_RANGE = 0.85;
final Point3d distFromBotCenter = isLeft ? new Point3d(- 0.036, 0.0554, 0) : new Point3d(+ 0.036, 0.0554, 0);
final Point3d endPoint = new Point3d(distFromBotCenter);
endPoint.add(new Point3d(0.0, MAX_RANGE, 0.0));
final boolean GP2Y0A60 = Config.getValue("GP2Y0A60").equals("true");
final Characteristic charstic = GP2Y0A60 ?
(isLeft ? new Characteristic("characteristics/gp2y0a60Left.txt", 100) : new Characteristic("characteristics/gp2y0a60Right.txt", 100))
: (isLeft ? new Characteristic("characteristics/gp2d12Left.txt", 100) : new Characteristic("characteristics/gp2d12Right.txt", 80));
simulators.add(new Runnable() {
private final double OPENING_ANGLE_IN_RAD = Math.toRadians(3);
public void run() {
double distInM = world.watchObstacle(parent.worldCoordFromBotCoord(distFromBotCenter), parent.worldCoordFromBotCoord(endPoint),
OPENING_ANGLE_IN_RAD, parent.getShape());
double distInCm = 100 * distInM;
double sensorReading = charstic.lookupPrecise(distInCm);
sensor.set(sensorReading);
}
});
}
示例2: buisitPocketSim
import javax.vecmath.Point3d; //導入方法依賴的package包/類
/**
* @param sensor Transportfach-Sensor
* @param isLeft immer true, denn es gibt nur einen Sensor
*/
public void buisitPocketSim(final Sensors.Trans sensor, final boolean isLeft) {
if (! isLeft) {
return; // es gibt nur einen Sensor, wir nehmen den Wert fuer links
}
final Point3d startOfSens = new Point3d(- 0.025, 0.025, 0);
final Point3d endOfSens = new Point3d(startOfSens);
endOfSens.add(new Point3d(0.05, 0, 0));
simulators.add(new Runnable() {
private final double OPENING_ANGLE_IN_RAD = Math.toRadians(3);
public void run() {
if (krautUndRuebenSim.getAssociatedObject() != null) {
sensor.set(1);
} else {
final double distInM = world.watchObstacle(
parent.worldCoordFromBotCoord(startOfSens),
parent.worldCoordFromBotCoord(endOfSens),
OPENING_ANGLE_IN_RAD,
parent.getShape());
sensor.set(distInM < 100 ? 1 :0);
}
}
});
}
示例3: create3D
import javax.vecmath.Point3d; //導入方法依賴的package包/類
private void create3D() {
super.create3D(true);
// construct sensor body - a line for each individual sensor ray.
Point3d[] coords = new Point3d[nbSensors * 2];
for (int i = 0; i < nbSensors; i++) {
Point3d start = new Point3d(positions[i]);
coords[i * 2] = start;
Point3d end = new Point3d(start);
Point3d direction = new Point3d(directions[i]);
if (((flags & FLAG_SHOW_FULL_SENSOR_RAY) == 0) && (type != TYPE_BUMPER))
direction.scale(0.05f); // just a small ray
end.add(direction);
coords[i * 2 + 1] = end;
}
LineArray line = new LineArray(coords.length, GeometryArray.COORDINATES);
line.setCoordinates(0, coords);
Appearance appear = new Appearance();
Material material = new Material();
ColoringAttributes ca = new ColoringAttributes();
ca.setColor(color);
appear.setColoringAttributes(ca);
appear.setMaterial(material);
Shape3D shape = new Shape3D(line, appear);
shape.setCollidable(false);
shape.setPickable(false);
addChild(shape);
}
示例4: getUntransformedPosition
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public Point3d getUntransformedPosition(Point3d position) {
this.untransformMatrix.transform(position);
position.add(new Point3d(0.5, 0.0, 0.5));
return position;
}
示例5: addMeshes
import javax.vecmath.Point3d; //導入方法依賴的package包/類
/************************* HACK ****************************************8
* This is a hacky method to associate different pairs of points on profile offsets
* (two identical dormer windows with meshes on them) - we cluster by distance.
*
* Needs the complete-language-overhall the system's been needing for a while...
*
* @param preview
* @param key
*/
@Override
public void addMeshes( Preview preview , Object key)
{
NormalPt TL = null, BR = null;
for (NormalPt np : normalPts)
{
if (anchorNames[np.anchorNo].compareTo("TL") == 0)
TL = np;
if (anchorNames[np.anchorNo].compareTo("BR") == 0)
BR = np;
}
if (TL == null || BR == null)
return;
Vector3d horizDelta = new Vector3d (BR.point);
horizDelta.sub(TL.point);
Vector3d vertDelta = new Vector3d (horizDelta);
horizDelta.z = 0;
vertDelta.x = 0;
vertDelta.y = 0;
if (xCount != 1)
horizDelta.scale(1./(xCount-1));
if (yCount != 1)
vertDelta.scale(1./(yCount-1));
for (int x = 0; x < xCount; x++)
for (int y = 0; y < yCount; y++)
{
Point3d start = new Point3d(TL.point);
Vector3d hD = new Vector3d (horizDelta);
hD.scale(x);
Vector3d vD = new Vector3d (vertDelta);
vD.scale(y);
start.add(vD);
start.add(hD);
Point3d end = new Point3d(start);
end.z -= scale * dropDown;
NormalPt
top = new NormalPt(end, TL.normal, TL.uphill, 0),
bottom = new NormalPt(start, TL.normal, TL.uphill, 1);
List<NormalPt> pts = new ArrayList(Arrays.asList(new NormalPt[] {top, bottom}) );
bind(pts, preview, key);
}
}
示例6: solidLine
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public void solidLine( Line3d oLine, double d ) {
Vector3d along = oLine.dir();
Point3d start = new Point3d ( oLine.start );
Vector3d tmp = new Vector3d( Mathz.Y_UP );
tmp.scale( d/2 );
start.add( tmp );
tmp.cross( Mathz.Y_UP, along );
tmp.scale( -d / ( 2 * tmp.length() ) );
start.add( tmp );
addCube ( start , Mathz.Y_UP, along, -d, oLine.length(), d);
}
示例7: castTo
import javax.vecmath.Point3d; //導入方法依賴的package包/類
public int castTo( float[] pos, BufferedImage image, Point3d worldHit, Vector3d worldNormal ) {
com.jme3.math.Vector3f worldDir = new com.jme3.math.Vector3f( pos[ 0 ], pos[ 1 ], pos[ 2 ] );
worldDir = worldDir.subtract( Jme3z.to(location) );
com.jme3.math.Vector3f dir = inverseGeomRot.mult( worldDir );
double angle = (( Math.atan2( -dir.x, dir.z ) + Math.PI ) % ( Math.PI * 2 )) / ( Math.PI * 2 );
double elevation = (Math.atan2( -dir.y, Math.sqrt( dir.x * dir.x + dir.z * dir.z ) ) + Math.PI / 2) / Math.PI ;
double[] rgb = new double[3];
if (image != null)
{
double x = angle * image.getWidth(),
y = elevation * image.getHeight(),
xF = x - Math.floor( x ),
yF = y - Math.floor( y );
get( image, Math.floor( x ), Math.floor( y ), ( 1 - xF ) * ( 1 - yF ), rgb );
get( image, Math.ceil ( x ), Math.floor( y ), xF * ( 1 - yF ), rgb );
get( image, Math.ceil ( x ), Math.ceil ( y ), xF * yF, rgb );
get( image, Math.floor( x ), Math.ceil ( y ), ( 1 - xF ) * yF, rgb );
}
if (worldHit != null) {
worldHit.x = Double.NaN;
if (planeNameCache.get() != name) {
planeNameCache.set( name );
planeMaskCache.set (getPlanePano() );
}
if ( planeMaskCache.get() != null ) {
double x = Mathz.clamp( (1-angle) * planeMaskCache.get().getWidth(), 0, planeMaskCache.get().getWidth()-1 ),
y = elevation * planeMaskCache.get().getHeight();
Color c = new Color ( planeMaskCache.get().getRGB( (int) x, (int) y ) );
int planeNo = (c.getRed() + c.getGreen() + c.getBlue() ) / 3;
if (planeNo < planes.size() && planeNo != 0) {
LinearForm3D plane = new LinearForm3D ( planes.get( planeNo ) );
{
double tmp = plane.B;
plane.B = plane.C;
plane.C = tmp;
plane.D = -plane.D;
plane.A = -plane.A;
}
Point3d pt = plane.collide( new Point3d(), Jme3z.from( dir ) );
{
com.jme3.math.Vector3f ptm = Jme3z.to( pt );
worldHit.set( Jme3z.from ( geomRot.mult( ptm ) ) );
worldHit.add( location );
worldNormal.set( Jme3z.from ( geomRot.mult( Jme3z.to(plane.normal()) ) ) );
}
}
}
}
return Colour.asInt( (int) rgb[ 0 ], (int) rgb[ 1 ], (int) rgb[ 2 ] );
}