Example #1
0
        [Test] public void Translation()
        {
            var m1 = new m4x4(v4.XAxis, v4.YAxis, v4.ZAxis, new v4(1.0f, 2.0f, 3.0f, 1.0f));
            var m2 = m4x4.Translation(new v4(1.0f, 2.0f, 3.0f, 1.0f));

            Assert.True(Math_.FEql(m1, m2));
        }
Example #2
0
 public AddOverlaysOnPaintEventArgs(ChartControl chart, DrawingContext gfx, m4x4 chart_to_client, EZone zone)
 {
     Chart         = chart;
     Gfx           = gfx;
     ChartToClient = chart_to_client;
     Zone          = zone;
 }
Example #3
0
 public static string Transform(m4x4 o2w, bool newline = false)
 {
     return
         (o2w == m4x4.Identity ? string.Empty :
          o2w.rot == m3x4.Identity ? Position(o2w.pos, newline) :
          "*o2w{*m4x4{" + Mat4x4(o2w) + "}}" + (newline?"\n":""));
 }
Example #4
0
 public Scope Group(string name, Colour32 colour, m4x4 transform)
 {
     return(Scope.Create(
                () => GroupOpen(name, colour),
                () => GroupClose(transform)
                ));
 }
Example #5
0
        [Test] public void Orthonormalise()
        {
            var a2b = new m4x4();

            a2b.x = new v4(-2.0f, 3.0f, 1.0f, 0.0f);
            a2b.y = new v4(4.0f, -1.0f, 2.0f, 0.0f);
            a2b.z = new v4(1.0f, -2.0f, 4.0f, 0.0f);
            a2b.w = new v4(1.0f, 2.0f, 3.0f, 1.0f);
            Assert.True(Math_.IsOrthonormal(Math_.Orthonormalise(a2b)));
        }
Example #6
0
        [Test] public void CreateFrom2()
        {
            var m1 = m4x4.Transform(1.0f, 0.5f, 0.7f, v4.Origin);
            var m2 = new m4x4(new quat(1.0f, 0.5f, 0.7f), v4.Origin);

            Assert.True(Math_.IsOrthonormal(m1));
            Assert.True(Math_.IsOrthonormal(m2));
            Assert.True(Math_.FEql(m1, m2));

            var rng  = new Random(123456879);
            var ang  = rng.FloatC(0.0f, 1.0f);
            var axis = v4.Random3N(0.0f, rng);

            m1 = m4x4.Transform(axis, ang, v4.Origin);
            m2 = new m4x4(new quat(axis, ang), v4.Origin);
            Assert.True(Math_.IsOrthonormal(m1));
            Assert.True(Math_.IsOrthonormal(m2));
            Assert.True(Math_.FEql(m1, m2));
        }
Example #7
0
            protected Element(Guid id, m4x4 position, string name)
            {
                View3d = View3d.Create();
                m_vbuf = new List <View3d.Vertex>();
                m_nbuf = new List <View3d.Nugget>();
                m_ibuf = new List <ushort>();

                Id              = id;
                Name            = name;
                m_chart         = null;
                m_impl_position = position;
                m_impl_bounds   = new BBox(position.pos, v4.Zero);
                m_impl_selected = false;
                m_impl_hovered  = false;
                m_impl_visible  = true;
                m_impl_visible_to_find_range = true;
                m_impl_screen_space          = false;
                m_impl_enabled = true;
                IsInvalidated  = true;
                UserData       = new Dictionary <Guid, object>();
            }
Example #8
0
 public LdrBuilder GroupClose(m4x4 transform)
 {
     return(Append(Ldr.Transform(transform, newline: true), "}\n"));
 }
Example #9
0
 public Scope Group(string name, m4x4 transform)
 {
     return(Group(name, 0xFFFFFFFF, transform));
 }
Example #10
0
 public void Axis(string name, Colour32 colour, m4x4 basis, float scale)
 {
     Append("*Matrix3x3 ", name, " ", colour, " {", basis.x * scale, " ", basis.y * scale, " ", basis.z * scale, " ", Ldr.Position(basis.pos), "}\n");
 }
Example #11
0
 /// <summary>Convert a matrix to a WPF media transform</summary>
 public static MatrixTransform ToTransform(this m4x4 o2w)
 {
     return(new MatrixTransform(o2w.x.x, o2w.x.y, o2w.y.x, o2w.y.y, o2w.pos.x, o2w.pos.y));
 }
Example #12
0
 public static string Axis(string name, Colour32 colour, m4x4 basis, float size = 1f)
 {
     return($"*Matrix3x3 {name} {colour} {{{Vec3(basis.x)} {Vec3(basis.y)} {Vec3(basis.z)} {Position(basis.pos)}}}\n");
 }
Example #13
0
 public void Axis(string name, Colour32 colour, m4x4 basis)
 {
     Axis(name, colour, basis, 0.1f);
 }
Example #14
0
 => AdjointMatrix(m1x1, m1x2, m1x3, m1x4, m1x5, m2x1, m2x2, m2x3, m2x4, m2x5, m3x1, m3x2, m3x3, m3x4, m3x5, m4x1, m4x2, m4x3, m4x4, m4x5, m5x1, m5x2, m5x3, m5x4, m5x5);
Example #15
0
 public LdrBuilder Axis(string name, Colour32 colour, m4x4 basis, float scale)
 {
     return(Append("*Matrix3x3 ", name, " ", colour, " {", basis.x * scale, " ", basis.y * scale, " ", basis.z * scale, " ", Ldr.Position(basis.pos), "}\n"));
 }
Example #16
0
 public LdrBuilder Axis(m4x4 basis)
 {
     return(Axis(string.Empty, Color_.FromArgb(0xFFFFFFFF), basis));
 }
Example #17
0
 => CofactorMatrix(
     m1x1, m1x2, m1x3, m1x4, m1x5,
     m2x1, m2x2, m2x3, m2x4, m2x5,
     m3x1, m3x2, m3x3, m3x4, m3x5,
     m4x1, m4x2, m4x3, m4x4, m4x5,
     m5x1, m5x2, m5x3, m5x4, m5x5);
Example #18
0
 public Gizmo(EMode mode, m4x4 o2w)
     : this(View3D_GizmoCreate(mode, ref o2w), true)
 {
 }
 => InverseMatrix(
     m1x1, m1x2, m1x3, m1x4, m1x5,
     m2x1, m2x2, m2x3, m2x4, m2x5,
     m3x1, m3x2, m3x3, m3x4, m3x5,
     m4x1, m4x2, m4x3, m4x4, m4x5,
     m5x1, m5x2, m5x3, m5x4, m5x5);
Example #20
0
 public LdrBuilder Axis(string name, Colour32 colour, m4x4 basis)
 {
     return(Axis(name, colour, basis, 0.1f));
 }
Example #21
0
 public void GroupClose(m4x4 transform)
 {
     Append(Ldr.Transform(transform, newline: true), "}\n");
 }
Example #22
0
 public static string Mat4x4(m4x4 mat)
 {
     Debug.Assert(Math_.IsFinite(mat));
     return($"{Vec4(mat.x)} {Vec4(mat.y)} {Vec4(mat.z)} {Vec4(mat.w)}");
 }
Example #23
0
 public void Axis(m4x4 basis)
 {
     Axis(string.Empty, Color_.FromArgb(0xFFFFFFFF), basis);
 }