From a254d0eabd97743a24444c02ff57e7b67a45cb43 Mon Sep 17 00:00:00 2001 From: Artem Makhno Date: Tue, 21 May 2024 13:29:30 +0300 Subject: [PATCH] VIS-6783 Make laser marks export depend on z axis of keypoints --- math/Frame3f.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/math/Frame3f.cs b/math/Frame3f.cs index 114d96b6..1f2f1569 100644 --- a/math/Frame3f.cs +++ b/math/Frame3f.cs @@ -3,6 +3,7 @@ using System.Text; using System.Diagnostics; using g3; +using System.Globalization; namespace g3 { @@ -68,6 +69,12 @@ public Frame3f(Vector3f origin, Vector3f x, Vector3f y, Vector3f z) this.rotation = m.ToQuaternion(); } + public Frame3f(double x, double y, double z, double rx, double ry, double rz, double rw) + { + this.origin = new Vector3f((float)x, (float)y, (float)z); + this.rotation = new Quaternionf((float)rx, (float)ry, (float)rz, (float)rw); + } + public Quaternionf Rotation { @@ -448,10 +455,17 @@ public readonly bool EpsilonEqual(Frame3f f2, float epsilon) { rotation.EpsilonEqual(f2.rotation, epsilon); } - - public override readonly string ToString() { - return ToString("F4"); + public readonly string ToShortString() { + string xString = origin.x.ToString("F4", CultureInfo.InvariantCulture); + string yString = origin.y.ToString("F4", CultureInfo.InvariantCulture); + string zString = origin.z.ToString("F4", CultureInfo.InvariantCulture); + string rxString = rotation.x.ToString("F4", CultureInfo.InvariantCulture); + string ryString = rotation.y.ToString("F4", CultureInfo.InvariantCulture); + string rzString = rotation.z.ToString("F4", CultureInfo.InvariantCulture); + string rwString = rotation.w.ToString("F4", CultureInfo.InvariantCulture); + return string.Join(", ", xString, yString, zString, rxString, ryString, rzString, rwString); } + public readonly string ToString(string fmt) { return string.Format("[Frame3f: Origin={0}, X={1}, Y={2}, Z={3}]", Origin.ToString(fmt), X.ToString(fmt), Y.ToString(fmt), Z.ToString(fmt)); }