/** * Specifies the rotation offset from the canonical location using yaw and pitch. * @param yaw Radian from -pi to pi * @param pitch Radian from -pi/2 to pi/2 * @param roll Radian from -pi to pi */ public void setDirection(double yaw, double pitch, double roll ) { ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,pitch,yaw,roll,R); }
/** * Specifies the rotation offset from the canonical location using yaw and pitch. * @param yaw Radian from -pi to pi * @param pitch Radian from -pi/2 to pi/2 * @param roll Radian from -pi to pi */ public void setDirection(double yaw, double pitch, double roll ) { ConvertRotation3D_F64.eulerToMatrix(EulerType.YZX,pitch,yaw,roll,R); }
public Se3_F64 createWorldToCamera() { // pick an appropriate amount of motion for the scene double z = baseline*focalLengthX/(minDisparity+rangeDisparity); double adjust = baseline/20.0; Vector3D_F64 rotPt = new Vector3D_F64(offsetX*adjust,offsetY*adjust,z* range); double radians = tiltAngle*Math.PI/180.0; DenseMatrix64F R = ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ,radians,0,0,null); Se3_F64 a = new Se3_F64(R,rotPt); return a; }
private void computeTransform() { // make sure the normal is pointing downwards (+y) to simplify later calculations if( normal.y < 0 ) normal.scale(-1); double rotX = Math.atan2(normal.z,normal.y); double rotZ = Math.atan2(normal.x,normal.y); ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, rotX, 0, rotZ, groundToLeft.R); groundToLeft.T.set(normal); groundToLeft.T.scale(distanceFromPlane); }
@Override public synchronized void mouseDragged(MouseEvent e) { double rotX = 0; double rotY = 0; double rotZ = 0; rotY += (e.getX() - prevX)*0.01; rotX += (prevY - e.getY())*0.01; Se3_F64 rotTran = new Se3_F64(); ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ,rotX,rotY,rotZ,rotTran.getR()); Se3_F64 temp = worldToCamera.concat(rotTran,null); worldToCamera.set(temp); prevX = e.getX(); prevY = e.getY(); repaint(); }
@Override public void mouseDragged(MouseEvent e) { double rotX = 0; double rotY = 0; double rotZ = 0; rotY += (e.getX() - prevX)*0.01; rotX += (prevY - e.getY())*0.01; Se3_F64 rotTran = new Se3_F64(); ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ,rotX,rotY,rotZ,rotTran.getR()); Se3_F64 temp = worldToCamera.concat(rotTran,null); worldToCamera.set(temp); prevX = e.getX(); prevY = e.getY(); repaint(); }
@Override public void mouseDragged(MouseEvent e) { double rotX = 0; double rotY = 0; double rotZ = 0; rotY += (e.getX() - prevX)*0.01; rotX += (prevY - e.getY())*0.01; Se3_F64 rotTran = new Se3_F64(); ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ,rotX,rotY,rotZ,rotTran.getR()); Se3_F64 temp = worldToCamera.concat(rotTran,null); synchronized (polygons) { worldToCamera.set(temp); } prevX = e.getX(); prevY = e.getY(); repaint(); }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void tranformSe3IntoTransform3D() { Se3_F64 a = new Se3_F64(); ConvertRotation3D_F64.eulerToMatrix(EulerType.XYZ, 0.1, -0.5, 1.2, a.getR()); a.getT().set(3.3, 1.2, -9); RigidBodyTransform b = new RigidBodyTransform(); MatrixTools.tranformSe3IntoTransform3D(a, b); Point3D_F64 p0 = new Point3D_F64(-1, 2, 3); Point3D p1 = new Point3D(p0.x, p0.y, p0.z); SePointOps_F64.transform(a, p0, p0); b.transform(p1); assertEquals(p0.x, p1.getX(), 1e-8); assertEquals(p0.y, p1.getY(), 1e-8); assertEquals(p0.z, p1.getZ(), 1e-8); }