Exemple #1
0
	void Decompose(Vector3<T>& vRotationAngle, Vector3<T>& vScale, Vector3<T>& vTranslate) {
		//이동
		vTranslate = Vector3<T>(w.x, w.y, w.z);
		
		//크기
		Vector3<T> scaleX(x.x, x.y, x.z);
		Vector3<T> scaleY(y.x, y.y, y.z);
		Vector3<T> scaleZ(z.x, z.y, z.z);
		vScale.x = scaleX.Length();
		vScale.y = scaleY.Length();
		vScale.z = scaleZ.Length();
		
		//회전
		float sx = z.y/vScale.z;
		float cx = sqrtf(1.0f - sx * sx);
		float xx, yy, zz;
		if (cx < 0.00001f) {
			if (sx > 0)
				xx = PI / 2;
			else
				xx = -PI / 2;

			yy = atan2f(z.x / vScale.z, x.x/vScale.x);
			zz = 0.0f;
		} else {
			xx = atan2f(sx, cx);
			yy = atan2f(-z.x / vScale.z, z.z / vScale.z);
			zz = atan2f(-x.y / vScale.x, y.y / vScale.y);
		}

		vRotationAngle = Vector3<T>(xx, yy, zz);
	}
void RimGeoMechView::updateScaleTransform()
{
    cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
    scale(2, 2) = scaleZ();

    this->scaleTransform()->setLocalTransform(scale);

    if (m_viewer) m_viewer->updateCachedValuesInScene();
}
void Shape::scale_change(GLfloat x) {
	scaleX(x);
	scaleY(x);
	scaleZ(x);
	MC.normalize();
}