本文整理汇总了Java中javax.media.j3d.Transform3D.setIdentity方法的典型用法代码示例。如果您正苦于以下问题:Java Transform3D.setIdentity方法的具体用法?Java Transform3D.setIdentity怎么用?Java Transform3D.setIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.j3d.Transform3D
的用法示例。
在下文中一共展示了Transform3D.setIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zoomOn
import javax.media.j3d.Transform3D; //导入方法依赖的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);
}
示例2: updateViewPlatformTransform
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Updates <code>viewPlatformTransform</code> transform from camera angles and location.
*/
private void updateViewPlatformTransform(Transform3D transform, float cameraX, float cameraY, float cameraZ,
float cameraYaw, float cameraPitch)
{
Transform3D yawRotation = new Transform3D();
yawRotation.rotY(-cameraYaw + Math.PI);
Transform3D pitchRotation = new Transform3D();
pitchRotation.rotX(-cameraPitch);
yawRotation.mul(pitchRotation);
transform.setIdentity();
transform.setTranslation(new Vector3f(cameraX, cameraZ, cameraY));
transform.mul(yawRotation);
this.camera = new Camera(cameraX, cameraY, cameraZ, cameraYaw, cameraPitch, 0);
}
示例3: RangeSensorBelt
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Constructs a RangeSensorBelt. The sensor type can be either
* TYPE_BUMPER,TYPE_SONAR,TYPE_IR or TYPE_LASER. Ranges are measured from
* the belt perimeter (not from the belt center).
*
* @param radius
* - the radius of the belt.
* @param minRange
* - the minimal range of each sensor ray. Not used for
* TYPE_BUMPER.
* @param maxRange
* - the maximal range of each sensor ray. Not used for
* TYPE_BUMPER.
* @param nbsensors
* - the number of sensors in the belt (typically 4,6,12,24 or
* 36).
* @param type
* - to specify the sensor behavior
*/
public RangeSensorBelt(float radius, float minRange, float maxRange, int nbsensors, int type, int flags) {
// compute angles ,positions , directions
positions = new Vector3d[nbsensors];
directions = new Vector3d[nbsensors];
Vector3d frontPos = new Vector3d(radius, 0, 0);
Vector3d frontDir = new Vector3d(maxRange, 0, 0);
angles = new double[nbsensors];
Transform3D transform = new Transform3D();
for (int i = 0; i < nbsensors; i++) {
angles[i] = i * 2 * Math.PI / nbsensors;
transform.setIdentity();
transform.rotY(angles[i]);
Vector3d pos = new Vector3d(frontPos);
transform.transform(pos);
positions[i] = pos;
Vector3d dir = new Vector3d(frontDir);
transform.transform(dir);
directions[i] = dir;
}
initialize(radius, maxRange, nbsensors, type, flags);
}
示例4: createBounds
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* @param newPos
* @param newHeading
* @param dX
* @param dY
* @param radius
* @param t Transformationsmatrix (wird veraendert)
* @return erzeugte Bounds
*/
private Bounds createBounds(Point3d newPos, double newHeading, double dX, double dY, double radius, Transform3D t) {
final double dZ = - CtBotSimTcp.BOT_HEIGHT / 2;
/* Vektor fuer die Verschiebung erstellen */
Vector3d v = new Vector3d(dX, dY, dZ);
/* Transformations-Matrix fuer die Rotation erstellen */
Transform3D r = new Transform3D();
r.rotZ(newHeading);
/* Transformation um Verschiebung ergaenzen */
r.transform(v);
v.add(newPos);
t.setIdentity();
t.setTranslation(v);
/* Bounds erstellen */
Bounds bounds = new BoundingSphere(new Point3d(0, 0, 0), radius);
/* Bounds transformieren */
bounds.transform(t);
return bounds;
}
示例5: RangeSensorBelt
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Constructs a RangeSensorBelt. The sensor type can be either
* TYPE_BUMPER,TYPE_SONAR,TYPE_IR or TYPE_LASER. Ranges are measured from the
* belt perimeter (not from the belt center).
*
* @param radius
* - the radius of the belt.
* @param minRange
* - the minimal range of each sensor ray. Not used for TYPE_BUMPER.
* @param maxRange
* - the maximal range of each sensor ray. Not used for TYPE_BUMPER.
* @param nbsensors
* - the number of sensors in the belt (typically 4,6,12,24 or 36).
* @param type
* - to specify the sensor behavior
* @param flags additional flags
*/
public RangeSensorBelt(float radius, float minRange, float maxRange, int nbsensors, int type, int flags) {
// compute angles ,positions , directions
positions = new Vector3d[nbsensors];
directions = new Vector3d[nbsensors];
Vector3d frontPos = new Vector3d(radius, 0, 0);
Vector3d frontDir = new Vector3d(maxRange, 0, 0);
angles = new double[nbsensors];
Transform3D transform = new Transform3D();
for (int i = 0; i < nbsensors; i++) {
angles[i] = i * 2 * Math.PI / nbsensors;
transform.setIdentity();
transform.rotY(angles[i]);
Vector3d pos = new Vector3d(frontPos);
transform.transform(pos);
positions[i] = pos;
Vector3d dir = new Vector3d(frontDir);
transform.transform(dir);
directions[i] = dir;
}
initialize(radius, maxRange, nbsensors, type, flags);
}
示例6: updatePosition
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Update the agent's position with instantTranslation and instantRotation
*/
protected void updatePosition() {
Transform3D t3d = t3d1;
if (!collisionDetected) {
// clip vertical deplacement to avoid traversing the floor
translation.get(v1);
double dist = v1.y - height / 2;
if (instantTranslation.y < (-dist)) {
instantTranslation.y = -dist;
}
double delta;
// perform translation
t3d.setIdentity();
t3d.setTranslation(instantTranslation);
translation.mul(t3d);
translationGroup.setTransform(translation);
// perform rotation
t3d.setIdentity();
t3d.rotY(instantRotation.y);
rotation.mul(t3d1);
rotationGroup.setTransform(rotation);
// add tranlation delta to odometer
delta = instantTranslation.length();
odometer += delta;
positionChanged = (delta != 0);
}
}
示例7: updatePosition
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Update the agent's position with instantTranslation and instantRotation
*/
protected void updatePosition() {
Transform3D t3d = t3d1;
if (!collisionDetected) {
// clip vertical deplacement to avoid traversing the floor
translation.get(v1);
double dist = v1.y - height / 2;
if (instantTranslation.y < (-dist)) {
instantTranslation.y = -dist;
}
double delta;
// perform translation
t3d.setIdentity();
t3d.setTranslation(instantTranslation);
translation.mul(t3d);
translationGroup.setTransform(translation);
// perform rotation
t3d.setIdentity();
t3d.rotY(instantRotation.y);
rotation.mul(t3d1);
rotationGroup.setTransform(rotation);
// add tranlation delta to odometer
delta = instantTranslation.length();
odometer += delta;
positionChanged = (delta != 0);
}
}
示例8: Projection
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
public Projection() {
K = new Matrix3d();
R = new Matrix3d();
T = new Vector3d();
P = new Transform3D();
K.setIdentity();
R.setIdentity();
T.set(0, 0, 0);
P.setIdentity();
}
示例9: initViewpoint
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Permet d'initialiser un point de vue (1) Vue depuis l'axe des XMax de la
* scene (2) Vue depuis l'axe des XMin de la scene (3) Vue depuis l'axe des
* YMax de la scene (4) Vue depuis l'axe des YMin de la scene (5) Vue depuis
* l'axe des ZMax de la scene (6) Vue depuis l'axe des ZMin de la scene
* @param axis
* Un entier correspondant à l'axe
* @return la distance entre la caméra et l'objet
*/
public double initViewpoint(int axis) {
Transform3D viewTrans = new Transform3D();
BoundingSphere sceneBounds = new BoundingSphere(this.Bgeneral.getBounds());
// point the view at the center of the object
Point3d center = new Point3d();
sceneBounds.getCenter(center);
double radius = sceneBounds.getRadius();
// On effectue cette Opération afin d'avoir toujours quelque chose à
// l'écran
radius = Math.min(radius, ConstantRepresentation.backClip * 2);
Point3d eyePos = new Point3d(center);
Vector3d up = new Vector3d();
// pull the eye back far enough to see the whole object
double eyeDist = radius;
switch (axis) {
case 1:
eyePos.x += eyeDist;
up.z = 1;
break;
case 2:
eyePos.x -= eyeDist;
up.z = 1;
break;
case 3:
eyePos.y += eyeDist;
up.z = 1;
break;
case 4:
eyePos.y -= eyeDist;
up.z = 1;
break;
case 5:
eyePos.z += eyeDist;
up.y = 1;
break;
case 6:
eyePos.z -= eyeDist;
up.y = 1;
break;
}
viewTrans.setIdentity();
viewTrans.lookAt(eyePos, center, up);
viewTrans.invert();
// set the view transform
InterfaceMap3D.tgvu.setTransform(viewTrans);
return eyeDist;
}
示例10: create3D
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/** Create the object geometry. */
void create3D(boolean allowTransformReadWrite) {
// STRUCTURE Branch group->Translation Transform Group -> Rotation
// Transform Group->Group
branchGroup = new BranchGroup();
branchGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
branchGroup.setCapability(BranchGroup.ALLOW_DETACH);
translation = new Transform3D();
translation.setIdentity();
translationGroup = new TransformGroup();
translationGroup.setTransform(translation);
branchGroup.addChild(translationGroup);
if (allowTransformReadWrite) {
translationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
translationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
translationGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
translationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_WRITE);
translationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_READ);
translationGroup.setCapabilityIsFrequent(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
// rotation transform
rotation = new Transform3D();
rotation.setIdentity();
rotationGroup = new TransformGroup();
rotationGroup.setTransform(rotation);
translationGroup.addChild(rotationGroup);
if (allowTransformReadWrite) {
rotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rotationGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
rotationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_READ);
rotationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_WRITE);
rotationGroup.setCapabilityIsFrequent(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
// Create group to attach all gemotries
group = new Group();
group.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
// we want to setup the bounds manually
group.setBoundsAutoCompute(false);
// group.setCapability(Group.ALLOW_BOUNDS_READ); // No more needed, use
// localBounds
rotationGroup.addChild(group);
}
示例11: changeViewPoint
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Change the user view Point . Note that we modify the ViewBranch transform
* not the scene transform.
*
* @param type
* can be VIEW_FROM_TOP,VIEW_FROM_EAST,VIEW_BEHIND_AGENT
* @param agent
* : specify the agent if VIEW_BEHIND_AGENT
*
* The VIEW_BEHIND_AGENT case has to be called regularly because
* of the agent displacement.
*/
public void changeViewPoint(int type, SimpleAgent agent) {
Point3d p1 = new Point3d();
Point3d p2 = new Point3d();
Transform3D t1 = new Transform3D();
Transform3D t2 = new Transform3D();
t1.setIdentity();
t2.setIdentity();
mouseOrbiter.resetView();
switch (type) {
case VIEW_FROM_TOP:
t1.lookAt(new Point3d(0, worldSize * 1.2, 0), new Point3d(0, 0, 0), new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_FROM_EAST:
t1.lookAt(new Point3d(worldSize, worldSize, 0), new Point3d(0, 0, 0), new Vector3d(-1, 0, 0));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_BEHIND_AGENT:
t1.setTranslation(new Vector3d(-agent.getRadius() * 2, 0, 0));
agent.getGroup().getLocalToVworld(t2);
t1.mul(t2);
viewTransformGroup.setTransform(t1);
break;
case VIEW_ABOVE_AGENT:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
p2.y = worldSize * .8;
t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_ABOVE_AGENT_NEAR:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
p2.y = agent.getHeight() * worldSize * 0.5;
// avoid front clipping
if (p2.y < 0.2)
p2.y = 0.2;
t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_AGENT_SIDE:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
agent.rotation.transform(p2);
t2.setTranslation(new Vector3d(0, agent.getHeight() * 2, agent.getRadius() * 10));
t2.transform(p2);
t1.lookAt(p2, p1, new Vector3d(0, 1, 0));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
}
}
示例12: createUniverse
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Creates the universe to attach the scenegraph. Used only in the creation
* phase.
*
* @param ed
* the environment description.
*/
private void createUniverse(EnvironmentDescription ed) {
System.out.println("create Universe");
// show infos
Map map = VirtualUniverse.getProperties();
System.out.println("----------------------------------------");
System.out.println("j3d.version = " + map.get("j3d.version"));
System.out.println("j3d.vendor = " + map.get("j3d.vendor"));
System.out.println("j3d.specification.version = " + map.get("j3d.specification.version"));
System.out.println("j3d.specification.vendor = " + map.get("j3d.specification.vendor"));
System.out.println("j3d.renderer = " + map.get("j3d.renderer"));
System.out.println("J3DThreadPriority = " + VirtualUniverse.getJ3DThreadPriority());
System.out.println("----------------------------------------");
createCanvas3D();
createSceneBranch(ed);
universe = new VirtualUniverse();
Locale locale = new Locale(universe);
// Create and add VIEW branch
// locale->viewBranch->viewTransformGroup->viewPlatform
viewBranch = new BranchGroup();
viewTransformGroup = new TransformGroup();
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
viewTransformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Transform3D t3d = new Transform3D();
t3d.setIdentity();
viewTransformGroup.setTransform(t3d);
viewBranch.addChild(viewTransformGroup);
// Creates View and viewplatform
viewPlatform = new ViewPlatform();
viewPlatform.setViewAttachPolicy(View.NOMINAL_HEAD);
viewPlatform.setActivationRadius(100);
view = new View();
view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION);
view.setViewPolicy(View.SCREEN_VIEW);
view.setVisibilityPolicy(View.VISIBILITY_DRAW_ALL);
view.setFrontClipDistance(0.02);
GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
template.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
template.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
/*
* GraphicsConfiguration config = GraphicsEnvironment
* .getLocalGraphicsEnvironment().getDefaultScreenDevice()
* .getBestConfiguration(template);
*/
// request antialiasing
view.setSceneAntialiasingEnable(true);
view.addCanvas3D(canvas3d);
PhysicalBody phyBody = new PhysicalBody();
PhysicalEnvironment phyEnv = new PhysicalEnvironment();
view.setPhysicalBody(phyBody);
view.setPhysicalEnvironment(phyEnv);
view.attachViewPlatform(viewPlatform);
viewTransformGroup.addChild(viewPlatform);
// Add both branch to the unique locale
locale.addBranchGraph(viewBranch);
locale.addBranchGraph(sceneBranch);
// Add mouse control in the canvas3d
mouseOrbiter = new MouseOrbiter(canvas3d, viewTransformGroup);
// sets initial viewpoint
changeViewPoint(ed.worldViewPoint, null);
}
示例13: run
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
@Override
public void run(String arg) {
// Open an image
String path = "/home/bene/PhD/brains/template.tif";
ImagePlus imp = IJ.openImage(path);
new StackConverter(imp).convertToGray8();
// Create a universe and show it
Image3DUniverse univ = new Image3DUniverse();
univ.show();
// Add the image as an isosurface
Content c = univ.addVoltex(imp);
sleep(5);
// Create a new Transform3D object
Transform3D t3d = new Transform3D();
// Make it a 45 degree rotation around the local y-axis
t3d.rotY(45 * Math.PI / 180);
// Apply the transformation to the Content. This concatenates
// the previous present transformation with the specified one
c.applyTransform(t3d);
sleep(5);
// Apply it again: this gives a 90 degree rotation in
// summary.
c.applyTransform(t3d);
sleep(5);
// setTransform() does not concatenate, but sets the specified
// transformation:
c.setTransform(t3d);
sleep(5);
// reset the transformation to the identity
t3d.setIdentity();
c.setTransform(t3d);
sleep(5);
// remove all contents and close the universe
univ.removeAllContents();
univ.close();
}
示例14: create3D
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/** Create the object geometry. */
void create3D(boolean allowTransformReadWrite) {
// STRUCTURE Branch group->Translation Transform Group -> Rotation
// Transform Group->Group
branchGroup = new BranchGroup();
branchGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
branchGroup.setCapability(BranchGroup.ALLOW_DETACH);
translation = new Transform3D();
translation.setIdentity();
translationGroup = new TransformGroup();
translationGroup.setTransform(translation);
branchGroup.addChild(translationGroup);
if (allowTransformReadWrite) {
translationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
translationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
translationGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
translationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_WRITE);
translationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_READ);
translationGroup.setCapabilityIsFrequent(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
// rotation transform
rotation = new Transform3D();
rotation.setIdentity();
rotationGroup = new TransformGroup();
rotationGroup.setTransform(rotation);
translationGroup.addChild(rotationGroup);
if (allowTransformReadWrite) {
rotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
rotationGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
rotationGroup.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
rotationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_READ);
rotationGroup.setCapabilityIsFrequent(TransformGroup.ALLOW_TRANSFORM_WRITE);
rotationGroup.setCapabilityIsFrequent(Node.ALLOW_LOCAL_TO_VWORLD_READ);
}
// Create group to attach all gemotries
group = new Group();
group.setCapability(Node.ALLOW_LOCAL_TO_VWORLD_READ);
// we want to setup the bounds manually
group.setBoundsAutoCompute(false);
// group.setCapability(Group.ALLOW_BOUNDS_READ); // No more needed, use
// localBounds
rotationGroup.addChild(group);
}
示例15: changeViewPoint
import javax.media.j3d.Transform3D; //导入方法依赖的package包/类
/**
* Change the user view Point . Note that we modify the ViewBranch transform
* not the scene transform.
*
* @param type
* can be VIEW_FROM_TOP,VIEW_FROM_EAST,VIEW_BEHIND_AGENT
* @param agent
* : specify the agent if VIEW_BEHIND_AGENT
*
* The VIEW_BEHIND_AGENT case has to be called regularly because of
* the agent displacement.
*/
public void changeViewPoint(int type, SimpleAgent agent) {
Point3d p1 = new Point3d();
Point3d p2 = new Point3d();
Transform3D t1 = new Transform3D();
Transform3D t2 = new Transform3D();
t1.setIdentity();
t2.setIdentity();
mouseOrbiter.resetView();
switch (type) {
case VIEW_FROM_TOP:
t1.lookAt(new Point3d(0, worldSize * 1.2, 0), new Point3d(0, 0, 0), new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_FROM_EAST:
t1.lookAt(new Point3d(worldSize, worldSize, 0), new Point3d(0, 0, 0), new Vector3d(-1, 0, 0));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_BEHIND_AGENT:
t1.setTranslation(new Vector3d(-agent.getRadius() * 2, 0, 0));
agent.getGroup().getLocalToVworld(t2);
t1.mul(t2);
viewTransformGroup.setTransform(t1);
break;
case VIEW_ABOVE_AGENT:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
p2.y = worldSize * .8;
t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_ABOVE_AGENT_NEAR:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
p2.y = agent.getHeight() * worldSize * 0.5;
// avoid front clipping
if (p2.y < 0.2)
p2.y = 0.2;
t1.lookAt(p2, p1, new Vector3d(0, 0, -1));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
case VIEW_AGENT_SIDE:
agent.getRotationTransformGroup().getLocalToVworld(t1);
t1.transform(p1);
t1.transform(p2);
agent.rotation.transform(p2);
t2.setTranslation(new Vector3d(0, agent.getHeight() * 2, agent.getRadius() * 10));
t2.transform(p2);
t1.lookAt(p2, p1, new Vector3d(0, 1, 0));
t1.invert();
viewTransformGroup.setTransform(t1);
break;
}
}