internal static bool Equal(Cylinder x, Cylinder y)
 {
     if (x == null || y == null)
         return false;
     return TransformationEqual(x.Transformation, y.Transformation) 
            && DoubleEqual(x.BaseRadius, y.BaseRadius) && DoubleEqual(x.Height, y.Height) && DoubleEqual(x.TopRadius, y.TopRadius);
 }
Esempio n. 2
0
 private void 柱体ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SharpGL.SceneGraph.Quadrics.Cylinder 柱体 = new SharpGL.SceneGraph.Quadrics.Cylinder()
     {
         Name = "柱体"
     };
     柱体.Material      = new Material();
     柱体.TextureCoords = true;//允许纹理贴图
     柱体.AddEffect(objectArcBallEffect);
     sceneControl1.Scene.SceneContainer.AddChild(柱体);
     treeView1.Nodes.Clear();
     AddElementToTree(sceneControl1.Scene.SceneContainer, treeView1.Nodes);
 }
Esempio n. 3
0
        protected override void DrawLine(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder frumstumShape = new SharpGL.SceneGraph.Quadrics.Cylinder();
            frumstumShape.TopRadius        = SizeY;
            frumstumShape.BaseRadius       = SizeX;
            frumstumShape.Height           = SizeZ;
            frumstumShape.Slices           = Slices;
            frumstumShape.Stacks           = Stacks;
            frumstumShape.QuadricDrawStyle = DrawStyle.Line;

            frumstumShape.CreateInContext(gl);
            frumstumShape.PushObjectSpace(gl);
            frumstumShape.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            frumstumShape.PopObjectSpace(gl);
            frumstumShape.DestroyInContext(gl);
        }
Esempio n. 4
0
        protected override void DrawLine(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder pyramid = new SharpGL.SceneGraph.Quadrics.Cylinder();
            pyramid.TopRadius        = SizeY;
            pyramid.BaseRadius       = SizeX;
            pyramid.Height           = SizeZ;
            pyramid.Slices           = Slices;
            pyramid.Stacks           = Stacks;
            pyramid.QuadricDrawStyle = DrawStyle.Line;

            pyramid.CreateInContext(gl);
            pyramid.PushObjectSpace(gl);
            pyramid.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            pyramid.PopObjectSpace(gl);
            pyramid.DestroyInContext(gl);
        }
Esempio n. 5
0
        protected override void DrawPoint(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder();
            cylinder.TopRadius        = SizeY;
            cylinder.BaseRadius       = SizeX;
            cylinder.Height           = SizeZ;
            cylinder.Slices           = Slices;
            cylinder.Stacks           = Stacks;
            cylinder.QuadricDrawStyle = DrawStyle.Point;

            cylinder.CreateInContext(gl);
            cylinder.PushObjectSpace(gl);
            cylinder.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            cylinder.PopObjectSpace(gl);
            cylinder.DestroyInContext(gl);
        }
Esempio n. 6
0
        protected override void DrawPoint(OpenGL gl)
        {
            SharpGL.SceneGraph.Quadrics.Cylinder pyramid = new SharpGL.SceneGraph.Quadrics.Cylinder();
            pyramid.TopRadius        = SizeY;
            pyramid.BaseRadius       = SizeX;
            pyramid.Height           = SizeZ;
            pyramid.Slices           = Slices;
            pyramid.Stacks           = Stacks;
            pyramid.QuadricDrawStyle = DrawStyle.Point;

            pyramid.CreateInContext(gl);
            pyramid.PushObjectSpace(gl);
            pyramid.Render(gl, SharpGL.SceneGraph.Core.RenderMode.Render);
            pyramid.PopObjectSpace(gl);
            pyramid.DestroyInContext(gl);

            //ve base radius by point
            gl.PushMatrix();
            gl.Rotate(45, 0, 0, 1);
            gl.Begin(OpenGL.GL_POINTS);
            double stacks = Stacks;
            double tempX  = SizeX * (System.Math.Sqrt(2)) / 2;
            double tempy  = SizeY;

            for (double j = 0; j <= SizeZ; j += SizeZ / Stacks)
            {
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(i, -tempX, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(i, tempX, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(-tempX, i, j);
                }
                for (double i = -tempX; i <= tempX; i += 0.1)
                {
                    gl.Vertex(tempX, i, j);
                }
                tempX -= ((SizeX - SizeY) / Stacks) * Math.Sqrt(2) / 2;
            }
            gl.End();
            gl.PopMatrix();
        }