private DataStructures.Geometric.Quaternion ToGeometric(OpenTK.Quaternion q) { DataStructures.Geometric.Quaternion ret; ret = new DataStructures.Geometric.Quaternion((decimal)q.X, (decimal)q.Y, (decimal)q.Z, (decimal)q.W); return(ret); }
private Quaternion GetKeyframeRot(bool prev = false) { int index = KeyFrameData.CurrentCell.RowIndex; if (prev) index -= 1; var x = Convert.ToDecimal(KeyFrameData.Rows[index].Cells[4].Value.ToString()); var y = Convert.ToDecimal(KeyFrameData.Rows[index].Cells[5].Value.ToString()); var z = Convert.ToDecimal(KeyFrameData.Rows[index].Cells[6].Value.ToString()); var w = Convert.ToDecimal(KeyFrameData.Rows[index].Cells[7].Value.ToString()); DataStructures.Geometric.Quaternion q = new DataStructures.Geometric.Quaternion(x,y,z,w); return q; }
private IUnitTransformation ResetTransform() { var mov = Matrix.Translation(-_document.Selection.GetSelectionBoundingBox().Center); OpenTK.Quaternion rev = new OpenTK.Quaternion((float)PrevRotation.X, (float)PrevRotation.Y, (float)PrevRotation.Z, (float)PrevRotation.W); rev.Invert(); var q = new DataStructures.Geometric.Quaternion(0, 0, 0, -1); var rot = Matrix.Rotation(q); var fin = Matrix.Translation(SolidsOrigin); PrevRotation = new DataStructures.Geometric.Quaternion((decimal)rev.X, (decimal)rev.Y, (decimal)rev.Z, (decimal)rev.W); var prev = Matrix.Rotation(PrevRotation); PrevRotation = q; return new UnitMatrixMult(fin * (rot * prev) * mov); }