public static PlaneProbeViewModel Create(MachineElementViewModel parent, Point3D point, double width = 100.0, double height = 100.0)
        {
            var t = parent.GetChainTansform();
            var p = t.Inverse.Transform(point);

            //var builder = new MeshBuilder();
            //var points = new List<Point3D>()
            //{
            //    p + new Vector3D(-width / 2.0, -height / 2.0, 0.0),
            //    p + new Vector3D(-width / 2.0, height / 2.0, 0.0),
            //    p + new Vector3D(width / 2.0, height / 2.0, 0.0),
            //    p + new Vector3D(width / 2.0, -height / 2.0, 0.0)
            //};

            //builder.AddPolygon(points);

            //return new PlaneProbeViewModel()
            //{
            //    X = p.X,
            //    Y = p.Y,
            //    Z = p.Z,
            //    SizeX = width,
            //    SizeY = height,
            //    Parent = parent,
            //    MeshGeometry = builder.ToMesh(),
            //    Fill = Brushes.Yellow
            //};

            return(null);
        }
        public static PlaneProbeViewModel Create(MachineElementViewModel parent, Point3D point, double width = 100.0, double height = 100.0)
        {
            var t       = parent.GetChainTansform();
            var p       = t.Invert().Transform(point);
            var builder = new MeshBuilder();
            var points  = new List <Point3D>()
            {
                p + new Vector3D(-width / 2.0, -height / 2.0, 0.0),
                p + new Vector3D(-width / 2.0, height / 2.0, 0.0),
                p + new Vector3D(width / 2.0, height / 2.0, 0.0),
                p + new Vector3D(width / 2.0, -height / 2.0, 0.0)
            };

            builder.AddPolygon(points);

            return(new PlaneProbeViewModel()
            {
                X = p.X,
                Y = p.Y,
                Z = p.Z,
                SizeX = width,
                SizeY = height,
                Parent = parent,
                MeshGeometry = builder.ToMesh(),
                Fill = Brushes.Yellow
            });
        }
Exemplo n.º 3
0
        public static PointProbeViewModel Create(MachineElementViewModel parent, Point3D point, double radius = 5.0)
        {
            var t       = parent.GetChainTansform();
            var p       = t.Invert().Transform(point);
            var builder = new MeshBuilder();

            builder.AddSphere(p, radius);

            var vm = new PointProbeViewModel()
            {
                X            = p.X,
                Y            = p.Y,
                Z            = p.Z,
                Radius       = radius,
                Parent       = parent,
                MeshGeometry = builder.ToMesh(),
                Fill         = Brushes.Yellow
            };

            vm._onIsSelectedChanged = (b) => vm.Fill = b ? Brushes.Red : Brushes.Yellow;
            vm.PropertyChanged     += (s, e) => vm.OnPropertyChanged(s, e);

            return(vm);
        }