Beispiel #1
0
void OrthRoot::setCameraForDraw(ci::Matrix44f& m){
	if(mCameraDirty) {
		setCinderCamera();
	}
	setGlCamera();

	// Account for src rect translation
	if(mSrcRect.x2 > mSrcRect.x1 && mSrcRect.y2 > mSrcRect.y1) {
		const float			sx = mDstRect.getWidth() / mSrcRect.getWidth(),
			sy = mDstRect.getHeight() / mSrcRect.getHeight();
		m.translate(ci::Vec3f(-mSrcRect.x1*sx, -mSrcRect.y1*sy, 0.0f));
		m.scale(ci::Vec3f(sx, sy, 1.0f));
	}
}
Beispiel #2
0
void BasePoseGrabber::convertFromBouguetPose(const ci::Matrix44f &in_pose, ci::Matrix44f &out_pose){

  out_pose.setToIdentity();

  ci::Vec3f translation = in_pose.getTranslate().xyz();
  translation[1] *= -1;
  translation[2] *= -1;
  out_pose.translate(translation);

  ci::Matrix33f flip;
  flip.setToIdentity();
  flip.at(1, 1) *= -1;
  flip.at(2, 2) *= -1;
  ci::Matrix33f in_gl_coords = flip * in_pose.subMatrix33(0, 0);
  ci::Quatf q(in_gl_coords);
  out_pose.rotate(q.getAxis(), q.getAngle());

  out_pose.invert(); //bouguet poses (from calibration) are grid poses so invert to get camera poses

}