private void CreateCubes() { // Create a cubes in 3D World space with TopLeft and BottomRight coordinates // We set some cubes to transparent colors to demonstrate Order Independent Transparency // NOTE: Coordinates are in world coordinates. If you want data coordinates, take a look at Axis.GetCoordinate() method to convert var cubeA = new CubeGeometry(new Vector3(0.0f, 0.0f, 0.0f), new Vector3(50.0f, 50.0f, 50.0f), Color.FromArgb(128, 255, 0, 0)); var cubeB = new CubeGeometry(new Vector3(50.0f, 0.0f, 50.0f), new Vector3(100.0f, 100.0f, 100.0f), Color.FromArgb(128, 0, 255, 0)); var cubeC = new CubeGeometry(new Vector3(100.0f, 0.0f, 100.0f), new Vector3(150.0f, 150.0f, 150.0f), Color.FromArgb(255, 0, 0, 255)); var cubeD = new CubeGeometry(new Vector3(-100.0f, 0.0f, -100.0f), new Vector3(0.0f, 150.0f, 0.0f), Color.FromArgb(255, 0, 255, 255)); var cubeE = new CubeGeometry(new Vector3(-150.0f, 0.0f, -150.0f), new Vector3(50.0f, 200.0f, 50.0f), Color.FromArgb(128, 255, 255, 255)); // force a far position on this cube ( user can do this in cases where a box inside another ) var cubeF = new CubeGeometry(new Vector3(-150.0f, 0.0f, -150.0f), new Vector3(-100.0f, 50.0f, -100.0f), Color.FromArgb(128, 255, 0, 0)); TSRVector3 farPosition = new TSRVector3(20000.0f, 20000.0f, 2000.0f); cubeF.SetPosition(farPosition); // Add the cubes to the 3D Scene sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeA); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeB); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeC); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeD); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeE); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeF); }
private void CreateCubes() { // Create a cubes in 3D World space with TopLeft and BottomRight coordinates // We set some cubes to transparent colors to demonstrate Order Independent Transparency var cubeA = new CubeGeometry(new Vector3(0.0f, 0.0f, 0.0f), new Vector3(50.0f, 50.0f, 50.0f), Color.FromArgb(128, 255, 0, 0)); var cubeB = new CubeGeometry(new Vector3(50.0f, 0.0f, 50.0f), new Vector3(100.0f, 100.0f, 100.0f), Color.FromArgb(128, 0, 255, 0)); var cubeC = new CubeGeometry(new Vector3(100.0f, 0.0f, 100.0f), new Vector3(150.0f, 150.0f, 150.0f), Color.FromArgb(255, 0, 0, 255)); var cubeD = new CubeGeometry(new Vector3(-100.0f, 0.0f, -100.0f), new Vector3(0.0f, 150.0f, 0.0f), Color.FromArgb(255, 0, 255, 255)); var cubeE = new CubeGeometry(new Vector3(-150.0f, 0.0f, -150.0f), new Vector3(50.0f, 200.0f, 50.0f), Color.FromArgb(128, 255, 255, 255)); var cubeF = new CubeGeometry(new Vector3(-150.0f, 0.0f, -150.0f), new Vector3(-100.0f, 50.0f, -100.0f), Color.FromArgb(128, 255, 0, 0)); // NOTE: Commented code below is the example of treating the Location value // as 3D point in Data Coordinates Space but not in World Coordinates Space //cubeA = new CubeGeometry(new Vector3(5.0f, 0.0f, 5.0f), new Vector3(6.0f, 1.0f, 6.0f), Color.FromArgb(128, 255, 0, 0)); //cubeB = new CubeGeometry(new Vector3(6.0f, 0.0f, 6.0f), new Vector3(7.0f, 2.0f, 7.0f), Color.FromArgb(128, 0, 255, 0)); //cubeC = new CubeGeometry(new Vector3(7.0f, 0.0f, 7.0f), new Vector3(8.0f, 3.0f, 8.0f), Color.FromArgb(255, 0, 0, 255)); //cubeD = new CubeGeometry(new Vector3(3.0f, 0.0f, 3.0f), new Vector3(5.0f, 3.0f, 5.0f), Color.FromArgb(255, 0, 255, 255)); //cubeE = new CubeGeometry(new Vector3(2.0f, 0.0f, 2.0f), new Vector3(6.0f, 4.0f, 6.0f), Color.FromArgb(128, 255, 255, 255)); //cubeF = new CubeGeometry(new Vector3(2.0f, 0.0f, 2.0f), new Vector3(3.0f, 1.0f, 3.0f), Color.FromArgb(128, 255, 0, 0)); // force a far position on this cube ( user can do this in cases where a box inside another ) TSRVector3 farPosition = new TSRVector3(20000.0f, 20000.0f, 2000.0f); cubeF.SetPosition(farPosition); // Add the cubes to the 3D Scene sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeA); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeB); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeC); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeD); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeE); sciChart3DSurface.Viewport3D.RootEntity.Children.Add(cubeF); }
public CubeGeometry(Vector3 topLeft, Vector3 bottomRight, Color cubeColor) { // Shady : Setting the position of scene entities will be used back when sorting them from camera perspective back to front using (TSRVector3 centerPosition = new TSRVector3( 0.5f * (topLeft.x + bottomRight.x), 0.5f * (topLeft.y + bottomRight.y), 0.5f * (topLeft.z + bottomRight.z))) { SetPosition(centerPosition); } this.topLeft = topLeft; this.bottomRight = bottomRight; this.cubeColor = cubeColor; }
public DrawGeometry(Vector3 firstPos, Vector3 secondPos, Color faceColor, CheckShape checkShape) { // Shady : Setting the position of scene entities will be used back when sorting them from camera perspective back to front using (TSRVector3 centerPosition = new TSRVector3( 0.5f * (firstPos.x + secondPos.x), 0.5f * (firstPos.y + secondPos.y), 0.5f * (firstPos.z + secondPos.z))) { SetPosition(centerPosition); } this.firstPos = firstPos; this.secondPos = secondPos; this.faceColor = faceColor; lineColor = Color.FromArgb(255, faceColor.R, faceColor.G, faceColor.B); this.checkShape = checkShape; circlePos = new List <Vector3>(); }