Exemple #1
0
        public override void Evaluate(int SpreadMax)
        {
            int spmax = ArrayMax.Max(FVertices.SliceCount,
                                     FIndices.SliceCount,
                                     this.BasePinsSpreadMax);

            if (this.FApply[0])
            {
                this.FShapes.SliceCount = spmax;

                for (int i = 0; i < spmax; i++)
                {
                    //Vector3D size = this.FSize[i];
                    Vector3[] vertices = new Vector3[this.FVertices[i].SliceCount];
                    int[]     inds     = new int[this.FIndices[i].SliceCount];

                    for (int j = 0; j < this.FVertices[i].SliceCount; j++)
                    {
                        vertices[j] = this.FVertices[i][j].ToBulletVector();
                    }

                    for (int j = 0; j < this.FIndices[i].SliceCount; j++)
                    {
                        inds[j] = Convert.ToInt16(this.FIndices[i][j]);
                    }

                    BvhShapeDefinition chull = new BvhShapeDefinition(vertices, inds);
                    chull.Mass = this.FMass[i];
                    this.SetBaseParams(chull, i);

                    this.FShapes[i] = chull;
                }
            }
        }
        public void Evaluate(int SpreadMax)
        {
            if (this.FPinInSoftProperties.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.SubPinsChanged)
            {
                this.FPinOutShapes.SliceCount =
                    ArrayMax.Max(
                        this.FPinInSoftProperties.SliceCount,
                        this.FPinInBendDist.SliceCount,
                        this.FPinInGenBend.SliceCount,
                        this.SubPinSpreadMax
                        );

                for (int i = 0; i < SpreadMax; i++)
                {
                    AbstractSoftShapeDefinition shape = this.GetShapeDefinition(i);

                    shape.GenerateBendingConstraints = this.FPinInGenBend[i];
                    shape.BendingDistance            = this.FPinInBendDist[i];
                    shape.Properties      = this.FPinInSoftProperties.IsConnected ? this.FPinInSoftProperties[i] : SoftBodyProperties.Default;
                    this.FPinOutShapes[i] = shape;
                }
            }
        }
Exemple #3
0
        public override void Evaluate(int SpreadMax)
        {
            int spmax = ArrayMax.Max(FVertices.SliceCount, this.BasePinsSpreadMax);

            if (this.FVertices.IsChanged || this.BasePinsChanged)
            {
                this.FShapes.SliceCount = spmax;

                for (int i = 0; i < spmax; i++)
                {
                    //Vector3D size = this.FSize[i];
                    Vector3[] vertices = new Vector3[this.FVertices[i].SliceCount];

                    for (int j = 0; j < this.FVertices[i].SliceCount; j++)
                    {
                        vertices[j] = this.FVertices[i][j].ToBulletVector();
                    }

                    ConvexHullShapeDefinition chull = new ConvexHullShapeDefinition(vertices);
                    chull.Mass = this.FMass[i];
                    this.SetBaseParams(chull, i);

                    this.FShapes[i] = chull;
                }
            }
        }
Exemple #4
0
        public void Evaluate(int SpreadMax)
        {
            if (this.FPinInMass.IsChanged ||
                this.FPinInDF.IsChanged ||
                this.FPinInDP.IsChanged ||
                this.FPinInPR.IsChanged ||
                this.FPinInAeroModel.IsChanged ||
                this.FPinInBendDist.IsChanged ||
                this.FPinInGenBend.IsChanged ||
                this.FPinInCHR.IsChanged ||
                this.FPinInDG.IsChanged ||
                this.FPinInAHR.IsChanged ||
                this.SubPinsChanged ||
                this.FPinInIsVolumeMass.IsChanged ||
                this.FPinInSHR.IsChanged ||
                this.FPinInVC.IsChanged)
            {
                this.FPinOutShapes.SliceCount =
                    ArrayMax.Max(
                        this.FPinInAeroModel.SliceCount,
                        this.FPinInBendDist.SliceCount,
                        this.FPinInCHR.SliceCount,
                        this.FPinInDF.SliceCount,
                        this.FPinInDP.SliceCount,
                        this.FPinInGenBend.SliceCount,
                        this.FPinInLF.SliceCount,
                        this.FPinInMass.SliceCount,
                        this.FPinInPR.SliceCount,
                        this.FPinInDG.SliceCount,
                        this.FPinInAHR.SliceCount,
                        this.FPinInIsVolumeMass.SliceCount,
                        this.FPinInSHR.SliceCount,
                        this.FPinInVC.SliceCount,
                        this.SubPinSpreadMax
                        );

                for (int i = 0; i < SpreadMax; i++)
                {
                    AbstractSoftShapeDefinition shape = this.GetShapeDefinition(i);
                    shape.Mass = this.FPinInMass[i];
                    shape.DampingCoefficient         = this.FPinInDP[i];
                    shape.DynamicFrictionCoefficient = this.FPinInDF[i];
                    shape.PressureCoefficient        = this.FPinInPR[i];
                    shape.LiftCoefficient            = this.FPinInLF[i];
                    shape.AeroModel = this.FPinInAeroModel[i];
                    shape.GenerateBendingConstraints = this.FPinInGenBend[i];
                    shape.BendingDistance            = this.FPinInBendDist[i];
                    shape.RigidContactHardness       = this.FPinInCHR[i];
                    shape.DragCoefficient            = this.FPinInDG[i];
                    shape.AnchorHardness             = this.FPinInAHR[i];
                    shape.IsVolumeMass        = this.FPinInIsVolumeMass[i];
                    shape.SoftContactHardness = this.FPinInSHR[i];
                    shape.VolumeConservation  = this.FPinInVC[i];
                    this.FPinOutShapes[i]     = shape;
                }
            }
        }
        public void FindMax_PozitiveElements_Test()
        {
            //Arrange

            int[] array = { 4, 23, 3, 11, 8 };

            //Act

            int result = ArrayMax.FindMax(array);

            //Assert

            Assert.AreEqual(23, result);
        }
        public void FindMax_NegativeElements_Test()
        {
            //Arrange

            int[] array = { -12, -45, -9, -20, -32 };

            //Act

            int result = ArrayMax.FindMax(array);

            //Assert

            Assert.AreEqual(-9, result);
        }
Exemple #7
0
        public override void Evaluate(int SpreadMax)
        {
            if ((this.FInMesh.IsChanged || this.BasePinsChanged) && this.FInMesh.PluginIO.IsConnected)
            {
                int spmax = ArrayMax.Max(FInMesh.SliceCount, this.BasePinsSpreadMax);

                for (int i = 0; i < spmax; i++)
                {
                    BvhShapeDefinition chull = new BvhShapeDefinition(this.FInMesh[i]);
                    chull.Mass = this.FMass[i];
                    this.SetBaseParams(chull, i);

                    this.FShapes[i] = chull;
                }
            }
        }
Exemple #8
0
        public override void Evaluate(int SpreadMax)
        {
            if ((this.FInMesh.IsChanged || this.BasePinsChanged) && this.FInMesh.IsConnected)
            {
                int spmax = ArrayMax.Max(FInMesh.SliceCount, this.BasePinsSpreadMax);

                this.FShapes.SliceCount = spmax;

                for (int i = 0; i < spmax; i++)
                {
                    BvhShapeDefinition shadeDef = new BvhShapeDefinition(this.FInMesh[i]);
                    this.SetBaseParams(shadeDef, i);

                    this.FShapes[i] = shadeDef;
                }
            }
        }
        public override void Evaluate(int SpreadMax)
        {
            int spmax = ArrayMax.Max(
                this.BasePinsSpreadMax,
                this.FPinInMaxH.SliceCount,
                this.FPinInMinH.SliceCount,
                this.FPinInResolution.SliceCount);

            if (this.FPinInData.IsChanged ||
                this.FPinInMaxH.IsChanged ||
                this.FPinInMinH.IsChanged ||
                this.FPinInResolution.PinIsChanged ||
                this.BasePinsChanged)
            {
                this.FShapes.SliceCount = spmax;
                for (int i = 0; i < spmax; i++)
                {
                    double resx, resz;
                    this.FPinInResolution.GetValue2D(0, out resx, out resz);
                    int iresx = Convert.ToInt32(resx);
                    int iresz = Convert.ToInt32(resz);

                    float[] data = new float[iresx * iresz];
                    for (int j = 0; j < iresx * iresz; j++)
                    {
                        data[j] = this.FPinInData[i][j];
                    }

                    HeightFieldShapeDefinition hf;
                    hf = new HeightFieldShapeDefinition(iresx, iresz, data, this.FPinInMinH[i], this.FPinInMaxH[i]);

                    this.SetBaseParams(hf, i);

                    this.FShapes[i] = hf;
                }
            }
        }