Beispiel #1
0
        /// <summary>
        /// 軸オブジェクトを生成
        /// </summary>
        /// <param name="gl"></param>
        private void setAxes(GLControlAlpha gl)
        {
            gl.DeleteAllObjects();
            var obj = new List <GLObject>();
            var r   = 0.065;
            //X軸
            var c = new C4(0.7f, 0.5f, 0.5f, 1f);

            obj.Add(new Cylinder(new V3(-1, 0, 0), new V3(2, 0, 0), r, new Material(c), DrawingMode.Surfaces));     //軸
            obj.Add(new Cone(new V3(1.1, 0, 0), new V3(-0.2, 0, 0), r * 2, new Material(c), DrawingMode.Surfaces)); //矢
            obj.Add(new TextObject("X", 11, new V3(1.25, 0, 0), 0, true, new Material(c)));

            //Y軸
            c = new C4(0.5f, 0.7f, 0.5f, 1f);
            obj.Add(new Cylinder(new V3(0, -1, 0), new V3(0, 2, 0), r, new Material(c), DrawingMode.Surfaces));     //軸
            obj.Add(new Cone(new V3(0, 1.1, 0), new V3(0, -0.2, 0), r * 2, new Material(c), DrawingMode.Surfaces)); //矢
            obj.Add(new TextObject("Y", 11, new V3(0, 1.25, 0), 0, true, new Material(c)));

            //Z軸
            c = new C4(0.5f, 0.5f, 0.7f, 1f);
            obj.Add(new Cylinder(new V3(0, 0, -1), new V3(0, 0, 2), r, new Material(c), DrawingMode.Surfaces));     //軸
            obj.Add(new Cone(new V3(0, 0, 1.1), new V3(0, 0, -0.2), r * 2, new Material(c), DrawingMode.Surfaces)); //矢
            obj.Add(new TextObject("Z", 11, new V3(0, 0, 1.25), 0, true, new Material(c)));

            //中央の球
            obj.Add(new Sphere(new V3(0, 0, 0), r * 2, new Material(C4.Gray), DrawingMode.Surfaces));

            gl.AddObjects(obj);
            gl.Refresh();
        }
Beispiel #2
0
 private void setObject(GLControlAlpha gl, V3[] dir, double[] angle)
 {
     gl.DeleteAllObjects();
     gl.AddObjects(createObject(gl, dir, angle));
     gl.Refresh();
 }
Beispiel #3
0
        /// <summary>
        /// ゴニオオブジェクトを生成
        /// </summary>
        /// <param name="gl"></param>
        /// <param name="dir"></param>
        /// <param name="angle"></param>
        private void setGonio(GLControlAlpha gl, V3[] dir, double[] angle)
        {
            gl.DeleteAllObjects();

            var r   = 0.05;
            var obj = new List <GLObject>();

            var rot = dir.Select((d, i) => Matrix3D.Rot(d, angle[i])).ToArray();

            //1st
            var mat = new Material(new C4(0.8f, 0.8f, 0f, 1f));

            obj.Add(new Cone(dir[0] * 2.1, dir[0] * -0.2, r * 2, mat, DrawingMode.Surfaces));//矢
            obj.Add(new TextObject(gl.Name.Contains("ReciPro") ? "Φ" : "1st", 12, dir[0] * 2.1 + dir[0].Normalized() * 0.01, 0.05, true, mat));

            if (!checkBoxEnable2nd.Checked)                                                                                                                    //2ndが存在しない時
            {
                obj.Add(new Cylinder(dir[0] * -1.9, dir[0] * 3.8, r, mat, DrawingMode.Surfaces));                                                              //軸
                obj.Add(new Torus(new V3(0, 0, 0), rot[0] * V3.Cross(dir[0], new V3(dir[0].Z, dir[0].X, dir[0].Y)), 1.6, r * 1.5, mat, DrawingMode.Surfaces)); //トーラス
            }
            else //2ndが存在する時
            {
                obj.Add(new Cylinder(dir[0] * -1.9, dir[0] * 0.3, r, mat, DrawingMode.Surfaces));                                //軸
                obj.Add(new Cylinder(dir[0] * 1.6, dir[0] * 0.3, r, mat, DrawingMode.Surfaces));                                 //軸
                //1stトーラスの法線は、1st軸と2nd軸が直交する方向
                obj.Add(new Torus(new V3(0, 0, 0), rot[0] * V3.Cross(dir[0], dir[1]), 1.6, r * 1.5, mat, DrawingMode.Surfaces)); //トーラス

                //以下2nd
                var rot01 = rot[0] * rot[1];
                mat = new Material(new C4(0f, 0.8f, 0.8f, 1f));
                var n = rot[0] * dir[1];
                obj.Add(new Cone(n * 2.0, -n * 0.2, r * 2, mat, DrawingMode.Surfaces));//矢
                obj.Add(new TextObject(gl.Name.Contains("ReciPro") ? "Θ" : "2nd", 12, n * 2.0 + n.Normalized() * 0.01, 0.05, true, mat));

                if (!checkBoxEnable3rd.Checked)
                {
                    obj.Add(new Cylinder(n * 1.9, -n * 3.8, r, mat, DrawingMode.Surfaces));                                                                       //軸
                    obj.Add(new Torus(new V3(0, 0, 0), rot01 * V3.Cross(dir[1], new V3(dir[1].Z, dir[1].X, dir[1].Y)), 1.1, r * 1.5, mat, DrawingMode.Surfaces)); //トーラス
                }
                else
                {
                    obj.Add(new Cylinder(n * 1.9, -n * 0.8, r, mat, DrawingMode.Surfaces));                                         //軸
                    obj.Add(new Cylinder(-n * 1.9, n * 0.8, r, mat, DrawingMode.Surfaces));                                         //軸
                    //2ndトーラスの法線は、2nd軸と3rd軸が直交する方向
                    obj.Add(new Torus(new V3(0, 0, 0), rot01 * V3.Cross(dir[1], dir[2]), 1.1, r * 1.5, mat, DrawingMode.Surfaces)); //トーラス

                    //以下、3rd
                    mat = new Material(new C4(0.8f, 0f, 0.8f, 1f));
                    var rot012 = rot[0] * rot[1] * rot[2];
                    n = rot[0] * rot[1] * dir[2];
                    obj.Add(new Cylinder(n * 1.3, -n * 2.6, r, mat, DrawingMode.Surfaces));  //軸
                    obj.Add(new Cone(n * 1.45, -n * 0.2, r * 2, mat, DrawingMode.Surfaces)); //矢
                    obj.Add(new TextObject(gl.Name.Contains("ReciPro") ? "Ψ" : "3rd", 12, n * 1.45 + n.Normalized() * 0.01, 0.05, true, mat));

                    if (dir[2].Z == 0)
                    {
                        obj.Add(new Torus(new V3(0, 0, 0), rot012 * new V3(0, 0, 1), 0.6, r * 1.5, mat, DrawingMode.Surfaces));//トーラス
                    }
                    else
                    {
                        obj.Add(new Torus(new V3(0, 0, 0), rot012 * new V3(0, 1, 0), 0.6, r * 1.5, mat, DrawingMode.Surfaces));//トーラス
                    }
                }
            }


            //中央の球
            obj.AddRange(createObject(gl, dir, angle));
            gl.AddObjects(obj);
            gl.Refresh();
        }