/// <summary> /// Initializes a new instance of the <see cref="FormHitTestSample"/> class. /// </summary> public FormHitTestSample() { InitializeComponent(); // Create a sphere. SharpGL.SceneGraph.Quadrics.Sphere sphere = new SharpGL.SceneGraph.Quadrics.Sphere(); sphere.Transformation.TranslateX = 2; sphere.Transformation.TranslateY = 2; // Create a cone. SharpGL.SceneGraph.Quadrics.Cylinder cone = new SharpGL.SceneGraph.Quadrics.Cylinder() { Name = "Cone" }; cone.BaseRadius = 1.5; cone.TopRadius = 0; cone.Height = 2; cone.Transformation.TranslateX = -2; cone.Transformation.TranslateY = -2; // Create a cylinder. SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder() { Name = "Cylinder" }; cylinder.BaseRadius = 1.5; cylinder.TopRadius = 1.5; cylinder.Height = 2; cylinder.Transformation.TranslateX = -2; cylinder.Transformation.TranslateY = 2; // Create a cube. Cube cube = new Cube(); cube.Transformation.TranslateX = 2; cube.Transformation.TranslateY = -2; cube.Transformation.RotateZ = 45f; // Add them. sceneControl1.Scene.SceneContainer.AddChild(sphere); sceneControl1.Scene.SceneContainer.AddChild(cube); sceneControl1.Scene.SceneContainer.AddChild(cone); sceneControl1.Scene.SceneContainer.AddChild(cylinder); }
private void sceneControl_Load(object sender, EventArgs e) { SharpGL.SceneGraph.Quadrics.Cylinder cylinder = new SharpGL.SceneGraph.Quadrics.Cylinder { BaseRadius = 0.0, Height = 5.0, TopRadius = 2.0, }; SharpGL.SceneGraph.Quadrics.Cylinder cylinderTop = new SharpGL.SceneGraph.Quadrics.Cylinder { BaseRadius = 2.0, Height = 20.0, TopRadius = 2.0 }; SharpGL.SceneGraph.Transformations.LinearTransformation linearTransformation = new SharpGL.SceneGraph.Transformations.LinearTransformation { TranslateZ = 5 }; SharpGL.SceneGraph.Effects.LinearTransformationEffect effect = new SharpGL.SceneGraph.Effects.LinearTransformationEffect { LinearTransformation = linearTransformation }; cylinderTop.Effects.Add(effect); SharpGL.SceneGraph.Primitives.Folder extruder = new SharpGL.SceneGraph.Primitives.Folder { Name = constExtruder }; sceneControl.Scene.SceneContainer.AddChild(extruder); extruder.AddChild(cylinder); extruder.AddChild(cylinderTop); }
private void buttonCylinder_Click(object sender, System.EventArgs e) { SharpGL.SceneGraph.Quadrics.Cylinder cy = new SharpGL.SceneGraph.Quadrics.Cylinder(); cy.TopRadius = cy.BaseRadius; AddObjectToScene(cy); }