Пример #1
0
        public void Play(Vector3 _startPos, Vector3 _endPos, float _angle, float _horiSpeed)
        {
            base.Play(_startPos, Vector3.zero);
            Vector3 horiDirection = UVector.GetXZLookDirection(_startPos, _endPos);
            Vector3 horiRight     = horiDirection.RotateDirectionClockwise(Vector3.up, 90);

            m_Direction       = horiDirection.RotateDirectionClockwise(horiRight, -_angle);
            m_HorizontalSpeed = _horiSpeed / Mathf.Cos(_angle * Mathf.Deg2Rad);
            m_SpeedMultiplier = 1f;
            float horiDistance  = Vector3.Distance(_startPos, _endPos);
            float duration      = horiDistance / _horiSpeed;
            float vertiDistance = Mathf.Tan(_angle * Mathf.Deg2Rad) * horiDistance;

            m_VerticalAcceleration = PhysicsExpressions.GetAcceleration(0, vertiDistance, duration);
        }
Пример #2
0
        private static void RE_PrintSubProperty(Export Exp)
        {
            int PropertyOffset = 0x18 + Exp.SerialOffset + 28;
            //Act
            Property Prop = new Property(pf.Bytes, PropertyOffset);

            Prop.SetStructType(StructType.Vector);
            //Assert
            string  Str = NameTable[Prop.NameTableRef];
            UVector uv  = Prop.Value as UVector;

            Console.WriteLine(uv.X);
            Console.WriteLine(uv.Y);
            Console.WriteLine(uv.Z);
        }
        protected override Matrix4 GetEleMatr()
        {
            Matrix4 mat = new Matrix4();

            mat.Identity();
            Point3d center = workMatr.GetCenter();
            UVector vecX   = new UVector();
            UVector vecY   = new UVector();
            UVector vecZ   = new UVector();

            workMatr.GetYAxis(ref vecZ);
            workMatr.GetXAxis(ref vecX);
            vecY = vecX ^ vecZ;
            UVector point = new UVector(center.X, center.Y, center.Z);

            mat.TransformToZAxis(point, vecX, vecY);
            return(mat);
        }
Пример #4
0
        public override Matrix4 GetEleMatr(int[] pre, Point3d center)
        {
            Matrix4 mat = new Matrix4();

            mat.Identity();
            center.Z = center.Z + (pre[1] / 2 - 1.2);
            Matrix4 workMat    = this.head.ConditionModel.Work.WorkMatr;
            Matrix4 workInvers = workMat.GetInversMatrix();

            workInvers.ApplyPos(ref center);
            UVector vecX = new UVector();
            UVector vecY = new UVector();
            UVector vecZ = new UVector();

            workMat.GetYAxis(ref vecZ);
            workMat.GetXAxis(ref vecX);
            vecY = vecX ^ vecZ;
            UVector point = new UVector(center.X, center.Y, center.Z);

            mat.TransformToZAxis(point, vecX, vecY);
            return(mat);
        }
Пример #5
0
 public void Evaluation(Vector <float> externalEvaluations, string type)
 {
     evaluations    = externalEvaluations;
     sumEvaluations = evaluations.Sum();
     if (type == "max")
     {
         bestIndividualIndex = evaluations.MaximumIndex();
     }
     else if (type == "min")
     {
         bestIndividualIndex = evaluations.MinimumIndex();
     }
     else
     {
         throw new System.ArgumentException("Not a good value for type");
     }
     bestIndividual = population.Column(bestIndividualIndex);
     bestScore      = evaluations[bestIndividualIndex];
     mean           = UVector.BuildMean(evaluations);
     stdDeviation   = UVector.BuildStdDeviation(evaluations);
     median         = UVector.BuildMedian(evaluations);
 }
        /// <summary>
        /// 获取电极矩阵
        /// </summary>
        /// <returns></returns>
        public Matrix4 GetEleMatr()
        {
            double  anle = UMathUtils.Angle(this.conditionModel.Work.WorkMatr.GetZAxis(), this.conditionModel.Vec);
            Matrix4 mat;

            if (UMathUtils.IsEqual(anle, 0))
            {
                mat = new Matrix4(this.conditionModel.Work.WorkMatr);
                mat.RolateWithX(Math.PI);
                return(mat);
            }
            else
            {
                UVector zVec  = new UVector(-this.conditionModel.Vec.X, -this.conditionModel.Vec.Y, -this.conditionModel.Vec.Z);
                UVector xVec  = new UVector();
                UVector yVec  = new UVector();
                Matrix4 inver = this.conditionModel.Work.WorkMatr.GetInversMatrix();

                UVector orinig = new UVector(CenterPt.X, CenterPt.Y, CenterPt.Z);
                inver.ApplyPos(ref orinig);
                double anle1 = UMathUtils.Angle(this.conditionModel.Work.WorkMatr.GetXAxis(), this.conditionModel.Vec);
                if (UMathUtils.IsEqual(anle1, 0) || UMathUtils.IsEqual(anle1, Math.PI))
                {
                    this.conditionModel.Work.WorkMatr.GetYAxis(ref yVec);
                    xVec = yVec ^ zVec;
                }
                else
                {
                    this.conditionModel.Work.WorkMatr.GetXAxis(ref xVec);
                    yVec = xVec ^ zVec;
                }
                mat = new Matrix4();
                mat.Identity();
                mat.TransformToZAxis(orinig, xVec, yVec);
                return(mat);
            }
        }
Пример #7
0
 public static Quaternion UVectorToQuaternion(UVector value) => (Quaternion)value;
Пример #8
0
 public static Vector4 UVectorToVector4(UVector value) => (Vector4)value;
Пример #9
0
 public static Vector3Int UVectorToVector3Int(UVector value) => Vector3ToVector3Int(value);
Пример #10
0
 public static Vector3 UVectorToVector3(UVector value) => (Vector3)value;
Пример #11
0
 public static Vector2 UVectorToVector2(UVector value) => (Vector2)value;
Пример #12
0
 public static float UVectorTofloat(UVector value) => (float)value;
Пример #13
0
 public static int UVectorToint(UVector value) => (int)value;
Пример #14
0
 protected override void Process(SIGProcessingContext context)
 {
     output = Result;
 }
Пример #15
0
 public static Vertex ToVertex(this UVector v)
 {
     return(new Vertex(v.X, v.Y, v.Z));
 }
Пример #16
0
 protected override void Process(SIGProcessingContext context)
 {
     output = GetValue(context);
 }