当前位置: 首页>>代码示例>>C#>>正文


C# Sphere类代码示例

本文整理汇总了C#中Sphere的典型用法代码示例。如果您正苦于以下问题:C# Sphere类的具体用法?C# Sphere怎么用?C# Sphere使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sphere类属于命名空间,在下文中一共展示了Sphere类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RealizaTeste

        public void RealizaTeste(List<BoundingVolume> boundingVolumes)
        {
            PRN = new List<PreRedeNeural> ();

            for (int i = 0; i < boundingVolumes.Count; i++)
            {
                if (tipo.AaA){

                    BoundingVolume c1 = boundingVolumes [i];
                    List<Vector> pontos = new List<Vector> ();
                    int nome2 = 0;
                    for (int j = 0; j < boundingVolumes.Count; j++) {
                        if (i != j) {
                            pontos.AddRange (boundingVolumes [j].Pontos.ToArray ());
                            nome2 += Convert.ToInt32 (Math.Pow (2,i));
                        }
                    }
                    BoundingVolume c2 = new OBB (pontos, nome2, boundingVolumes [i].nivel);

                    if (tipo.BV == 2){

                    }
                    if (tipo.BV == 1){
                        //caixas.Add(new AABB(dadosTreino[i], "-" + i.ToString() + "-",0));
                    }
                    if (tipo.BV == 0){
                        c2 = new Sphere (pontos, nome2, boundingVolumes [i].nivel);
                    }

                    //encontra todos os planos
                    List<Plano> planos = testeColisao (c1, c2);

                    //seleciona os melhores planos
                    planos = SelecionaPlanos (c1, c2, planos);

                    //gera a pré-rede neural
                    PreRedeNeural p = GeraPreRedeNeural (c1, c2, planos);

                    PRN.Add (p);
                }
                else
                {
                    BoundingVolume c1 = boundingVolumes [i];
                    for (int j=i+1; j<boundingVolumes.Count; j++) {
                        //encontra os planos
                        BoundingVolume c2 = boundingVolumes [j];
                        List<Plano> planos = testeColisao (c1, c2);

                        //seleciona os melhores planos
                        planos = SelecionaPlanos (c1, c2, planos);

                        //gera a pré-rede neural
                        PreRedeNeural p = GeraPreRedeNeural (c1, c2, planos);

                        PRN.Add (p);
                    }
                }
                 Console.WriteLine(" + - RN " + i.ToString() + " gerada.");
            }
        }
开发者ID:rmaalmeida,项目名称:NNCG,代码行数:60,代码来源:TesteColisao.cs

示例2: SphereObject

 /// <summary>
 /// Initializes a new instance of the <see cref="SphereObject"/> class.
 /// </summary>
 /// <param name="pos">The pos.</param>
 /// <param name="raio">The raio.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="materialDescription">The material description.</param>
 public SphereObject(Vector3 pos, float raio, float mass = 10,float scale = 1,MaterialDescription materialDescription = null)
     : base(materialDescription,mass)
 {
 
     this.scale = new Vector3(scale);
     entity = new Sphere(pos, raio * scale, mass);            
 }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:15,代码来源:SphereObject.cs

示例3: PlanetDemo

        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public PlanetDemo(DemosGame game)
            : base(game)
        {
            Space.ForceUpdater.Gravity = Vector3.Zero;

            //By pre-allocating a bunch of box-box pair handlers, the simulation will avoid having to allocate new ones at runtime.
            NarrowPhaseHelper.Factories.BoxBox.EnsureCount(1000);

            var planet = new Sphere(new Vector3(0, 0, 0), 30);
            Space.Add(planet);

            var field = new GravitationalField(new InfiniteForceFieldShape(), planet.Position, 66730 / 2f, 100);
            Space.Add(field);

            //Drop the "meteorites" on the planet.
            Entity toAdd;
            int numColumns = 10;
            int numRows = 10;
            int numHigh = 10;
            float separation = 5;
            for (int i = 0; i < numRows; i++)
                for (int j = 0; j < numColumns; j++)
                    for (int k = 0; k < numHigh; k++)
                    {
                        toAdd = new Box(new Vector3(separation * i - numRows * separation / 2, 40 + k * separation, separation * j - numColumns * separation / 2), 1f, 1f, 1f, 5);
                        toAdd.LinearVelocity = new Vector3(30, 0, 0);
                        toAdd.LinearDamping = 0;
                        toAdd.AngularDamping = 0;
                        Space.Add(toAdd);
                    }
            game.Camera.Position = new Vector3(0, 0, 150);
        }
开发者ID:gpforde,项目名称:GPBrakes,代码行数:36,代码来源:PlanetDemo.cs

示例4: ModifyObjectColor

    public static Result ModifyObjectColor(RhinoDoc doc)
    {
        ObjRef obj_ref;
        var rc = RhinoGet.GetOneObject("Select object", false, ObjectType.AnyObject, out obj_ref);
        if (rc != Result.Success)
          return rc;
        var rhino_object = obj_ref.Object();
        var color = rhino_object.Attributes.ObjectColor;
        bool b = Rhino.UI.Dialogs.ShowColorDialog(ref color);
        if (!b) return Result.Cancel;

        rhino_object.Attributes.ObjectColor = color;
        rhino_object.Attributes.ColorSource = ObjectColorSource.ColorFromObject;
        rhino_object.CommitChanges();

        // an object's color attributes can also be specified
        // when the object is added to Rhino
        var sphere = new Sphere(Point3d.Origin, 5.0);
        var attributes = new ObjectAttributes();
        attributes.ObjectColor = Color.CadetBlue;
        attributes.ColorSource = ObjectColorSource.ColorFromObject;
        doc.Objects.AddSphere(sphere, attributes);

        doc.Views.Redraw();
        return Result.Success;
    }
开发者ID:acormier,项目名称:RhinoCommonExamples,代码行数:26,代码来源:ex_modifyobjectcolor.cs

示例5: Sphere_Constructor_saves_radius

 public void Sphere_Constructor_saves_radius()
 {
     var centre = new Point(50.0f, -12.0f, 4.2f);
     var radius = 12.2f;
     var s = new Sphere(centre, radius);
     Assert.AreEqual(radius, s.Radius);
 }
开发者ID:EddPorter,项目名称:RayManCS,代码行数:7,代码来源:SphereTests.cs

示例6: BroadPhaseDemo

        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public BroadPhaseDemo(DemosGame game)
            : base(game)
        {
            //Make a fatter kapow sphere.
            Space.Remove(kapow);
            kapow = new Sphere(new Vector3(11000, 0, 0), 1.5f, 1000);
            Space.Add(kapow);
            Space.Solver.IterationLimit = 1; //Essentially no sustained contacts, so don't need to worry about accuracy.
            Space.ForceUpdater.Gravity = Vector3.Zero;

            int numColumns = 15;
            int numRows = 15;
            int numHigh = 15;
            float separation = 3;

            Entity toAdd;

            for (int i = 0; i < numRows; i++)
                for (int j = 0; j < numColumns; j++)
                    for (int k = 0; k < numHigh; k++)
                    {
                        toAdd = new Box(new Vector3(separation * i, k * separation, separation * j), 1, 1, 1, 1);
                        toAdd.Material.Bounciness = 1; //Superbouncy boxes help propagate shock waves.
                        toAdd.LinearDamping = 0f;
                        toAdd.AngularDamping = 0f;
                        Space.Add(toAdd);
                    }

            game.Camera.Position = new Vector3(0, 3, -10);
            game.Camera.ViewDirection = new Vector3(0, 0, 1);
        }
开发者ID:EugenyN,项目名称:BEPUphysicsMG,代码行数:35,代码来源:BroadPhaseDemo.cs

示例7: Window

        public Window()
            : base(640, 480, GraphicsMode.Default, "XSharp")
        {
            GL.Enable(EnableCap.DepthTest);

            ISharpShape shape = new Sphere().Subsect(new Vector(0.5, 0.5, 0.5), new Vector(0.5, 0.5, 0.5));
            this.Tree = OctoTree.Create(shape, 5);

            PointCloud.Point[] points = new PointCloud.Point[80000];
            for (int t = 0; t < points.Length; t++)
            {
                double ang = (double)t / (double)points.Length * Math.PI * 2.0;
                double elv = (double)Math.Sin(ang * 100.0);
                double x = (double)Math.Sin(ang);
                double z = (double)Math.Cos(ang);
                points[t] = new PointCloud.Point()
                {
                    Position = new Vector(x, z, elv),
                    A = 255,
                    R = 0,
                    G = 255,
                    B = 0
                };
            }

            this.MyPointCloud = new PointCloud();
            this.MyPointCloud.Submit(points, 2.0f);
        }
开发者ID:dzamkov,项目名称:XSharp,代码行数:28,代码来源:Window.cs

示例8: TestableInput

 public TestableInput(TestableGameObject obj, IInput input,
                      Sphere sphere)
     : base(obj)
 {
     this.sphere = sphere;
     this.input = input;
 }
开发者ID:ZackGill,项目名称:Uniject,代码行数:7,代码来源:TestableInput.cs

示例9: Run

        public static void Run()
        {
            // Initialize scene object
            Scene scene = new Scene();

            // Initialize Node class object
            Node cubeNode = new Node("sphere");

            // ExStart:ConvertSpherePrimitivetoMesh
            // Initialize object by Sphere class
            IMeshConvertible convertible = new Sphere();
            
            // Convert a Sphere to Mesh
            Mesh mesh = convertible.ToMesh();
            // ExEnd:ConvertSpherePrimitivetoMesh

            // Point node to the Mesh geometry
            cubeNode.Entity = mesh;

            // Add Node to a scene
            scene.RootNode.ChildNodes.Add(cubeNode);

            // The path to the documents directory.
            string MyDir = RunExamples.GetDataDir() + RunExamples.GetOutputFilePath("SphereToMeshScene.fbx");

            // Save 3D scene in the supported file formats
            scene.Save(MyDir, FileFormat.FBX7400ASCII);

            Console.WriteLine("\n Converted the primitive Sphere to a mesh successfully.\nFile saved at " + MyDir);
        }
开发者ID:aspose-3d,项目名称:Aspose.3D-for-.NET,代码行数:30,代码来源:ConvertSpherePrimitivetoMesh.cs

示例10: SetCollision

 public void SetCollision()
 {
     MotionState motionState = new MotionState();
     motionState.Position = Position;
     motionState.Orientation = Quaternion.Identity;
     Entity = new Sphere(motionState, radius, mass);
 }
开发者ID:slicedpan,项目名称:demo,代码行数:7,代码来源:SphereComponent.cs

示例11: IncomingDemo

        /// <summary>
        /// Constructs a new demo.
        /// </summary>
        /// <param name="game">Game owning this demo.</param>
        public IncomingDemo(DemosGame game)
            : base(game)
        {
            Entity toAdd;
            //Build the stack...
            for (int k = 1; k <= 12; k++)
            {
                if (k % 2 == 1)
                {
                    toAdd = new Box(new Vector3(-3, k, 0), 1, 1, 7, 10);
                    Space.Add(toAdd);
                    toAdd = new Box(new Vector3(3, k, 0), 1, 1, 7, 10);
                    Space.Add(toAdd);
                }
                else
                {
                    toAdd = new Box(new Vector3(0, k, -3), 7, 1, 1, 10);
                    Space.Add(toAdd);
                    toAdd = new Box(new Vector3(0, k, 3), 7, 1, 1, 10);
                    Space.Add(toAdd);
                }
            }
            //And then smash it!
            toAdd = new Sphere(new Vector3(0, 150, 0), 3, 100);

            Space.Add(toAdd);
            Space.Add(new Box(new Vector3(0, 0, 0), 10, 1f, 10));
            game.Camera.Position = new Vector3(0, 6, 30);
        }
开发者ID:gpforde,项目名称:GPBrakes,代码行数:33,代码来源:IncomingDemo.cs

示例12: sphere

 public void sphere(Vector3 a, float r, Color c) {
     var s = new Sphere();
     s.At = a;
     s.Radius = r;
     s.Col = c;
     Spheres.Add(s);
 }
开发者ID:jimc1664,项目名称:Space-Dota,代码行数:7,代码来源:Unit.cs

示例13: SphereScene

			internal static Scene SphereScene (int level, Vector center, double radius)
			{
				Sphere sphere = new Sphere (center, radius);
				if (level == 1) { 
					return sphere;
				} else {
					Group scene = new Group (new Sphere (center, 3.0 * radius));
					scene.Add (sphere);
					double rn = 3.0 * radius / Math.Sqrt (12.0);

					for (int dz = -1; dz <= 1; dz += 2) {
						for (int dx = -1; dx <= 1; dx += 2) {

							Vector c2 = new Vector (
								                       center.x - dx * rn
                     , center.y + rn
                     , center.z - dz * rn
							                       );

							scene.Add (SphereScene (level - 1, c2, radius / 2.0));
						}
					}
					return scene;
				}
			}
开发者ID:lewurm,项目名称:benchmarker,代码行数:25,代码来源:raytracer3.cs

示例14: CharacterCardBase

 protected CharacterCardBase(CardType printedCardType, string title, CardSet cardSet, uint cardNumber, Sphere printedSphere, byte printedWillpower, byte printedAttack, byte printedDefense, byte printedHitPoints)
     : base(printedCardType, title, cardSet, cardNumber, printedSphere)
 {
     this.PrintedWillpower = printedWillpower;
     this.PrintedAttack = printedAttack;
     this.PrintedDefense = printedDefense;
     this.PrintedHitPoints = printedHitPoints;
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:8,代码来源:CharacterCardBase.cs

示例15: MainForm

 public MainForm()
 {
     InitializeComponent();
     p = new Perspective(this);
     testSphere = new Sphere (new Point3(100, 100, 0), 100, Color.Yellow);
     testSphere2 = new Sphere (new Point3 (250, 250, 0), 50, Color.Blue);
     testSphere3 = new Sphere (new Point3 (250, 250, 0), 10, Color.Wheat);
 }
开发者ID:GregBlow,项目名称:orrery,代码行数:8,代码来源:Program.cs


注:本文中的Sphere类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。