Beispiel #1
0
        static void Main(string[] args)
        {
            List <CompontParam> param_list = new List <CompontParam>();
            CompontParam        param      = new CompontParam();

            param.name  = "test";
            param.param = new List <double>();
            param.param.Add(11);
            param_list.Add(param);
            RayLineCluster input = new RayLineCluster();

            input.ray_cluster = new List <RayLine>();
            RayLine line = new RayLine();

            line.start_point   = new Vector3();
            line.normal_line   = new Vector3();
            line.start_point.x = 1;
            line.start_point.y = 2;
            line.start_point.z = 3;
            line.normal_line.x = 4;
            line.normal_line.y = 5;
            line.normal_line.z = 6;

            input.ray_cluster.Add(line);
            List <RayLineCluster> output = new List <RayLineCluster>();

            TBTfront.Ant ant = new TBTfront.Ant();
            int          res = ant.clacLight(param_list, input, output);

            Console.WriteLine(output.Count);
            Console.WriteLine(output[0].ray_cluster[0].start_point.x);
            Console.WriteLine(output[0].ray_cluster[0].normal_line.y);
            Console.ReadKey();
        }
Beispiel #2
0
        private void calculateGaussionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (var combo in _data_mananger._list_combo)
            {
                List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();
                for (int i = 0; i < combo.data_list.Count; i++)
                {
                    list_data.Add(combo.data_list[i]);
                }

                // 调后台生成光线
                TBTfront.Ant           ant          = new TBTfront.Ant();
                List <GaussianCluster> cluster_list = new List <GaussianCluster>();
                GaussianCluster        cluster      = new GaussianCluster();
                CalcOption             opt          = new CalcOption();
                int res = ant.clacGaussian(list_data, cluster, cluster_list, opt);
                if (res != 0)
                {
                    //MessageBox();
                    continue;
                }
                _render.RemoveViewProp(combo.actorGaussian);
                combo.actorGaussian = FrustumCone.genActor(cluster_list);
                _render.AddViewProp(combo.actorGaussian);
            }
            updateVtk();
        }
Beispiel #3
0
        private void updateLight()
        {
            foreach (var combo in _data_mananger._list_combo)
            {
                CompontData data   = combo.data_list[0];
                SourceData  source = (SourceData)data;

                List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();
                for (int i = 1; i < combo.data_list.Count; i++)
                {
                    list_data.Add(combo.data_list[i]);
                }

                // 调后台生成光线
                TBTfront.Ant          ant          = new TBTfront.Ant();
                List <RayLineCluster> cluster_list = new List <RayLineCluster>();
                CalcOption            opt          = new CalcOption();
                int res = ant.clacLight(list_data, source.rayline_cluster, cluster_list, opt);
                if (res != 0)
                {
                    System.Windows.Forms.MessageBox.Show("claclate ray failed, res:" + res.ToString());
                    continue;
                }
                _render.RemoveViewProp(combo.actor);
                combo.actor = CompontFactory.genRayActor(cluster_list);
                _render.AddViewProp(combo.actor);
            }
            updateVtk();
        }
Beispiel #4
0
        public void genRays(RayLineCluster rayline_cluster, double ds = 0)
        {
            // 调后台生成光线
            TBTfront.Ant ant = new TBTfront.Ant();
            List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();

            list_data.Add(this);
            List <TBTfront.RayLineCluster> rayline_list = new List <TBTfront.RayLineCluster>();
            CalcOption opt = new CalcOption();

            opt.is_ign_non_intersection = true;
            opt.is_ign_restriction      = true;
            ant.clacLight(list_data, rayline_cluster, rayline_list, opt);
            rayline_cluster = rayline_list[1];
        }
Beispiel #5
0
        public void update()
        {
            // 调后台生成场
            TBTfront.Ant ant = new TBTfront.Ant();
            List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();

            list_data.Add(this);
            this.field = new TBTfront.FieldBase();
            ant.clacField(list_data, this.field, this.field);
            // 调后台生成光线
            List <TBTfront.RayLineCluster> rayline_list = new List <TBTfront.RayLineCluster>();
            CalcOption opt = new CalcOption();

            ant.clacLight(list_data, this.rayline_cluster, rayline_list, opt);
            this.rayline_cluster = rayline_list[1];
        }
Beispiel #6
0
        static public vtkAlgorithmOutput calcRestriction(CompontData data)
        {
            //calculation::RayTracing rayTracing(this);
            Restriction rest = (Restriction)data.restriction;

            if (rest == null)
            {
                return(null);
            }

            // 调后台生成光线
            TBTfront.Ant ant = new TBTfront.Ant();
            List <TBTfront.CompontParam> list_data = new List <TBTfront.CompontParam>();

            list_data.Add(rest);
            list_data.Add(data);
            List <TBTfront.RayLineCluster> rayline_list = new List <TBTfront.RayLineCluster>();
            RayLineCluster rayline_cluster = new RayLineCluster();
            CalcOption     opt             = new CalcOption();

            opt.is_ign_non_intersection = true;
            opt.is_ign_restriction      = true;
            ant.clacLight(list_data, rayline_cluster, rayline_list, opt);
            rayline_cluster = rayline_list[2];


            vtkPoints points = vtkPoints.New();

            foreach (var ray in rayline_cluster.ray_cluster)
            {
                points.InsertNextPoint(ray.start_point.x,
                                       ray.start_point.y,
                                       ray.start_point.z);
            }

            vtkPolyData polyData = vtkPolyData.New();

            polyData.SetPoints(points);

            vtkDelaunay2D delaunay = vtkDelaunay2D.New();

            delaunay.SetInput(polyData);
            delaunay.Update();
            return(delaunay.GetOutputPort());
        }