示例#1
0
 public FCurveKeyframe(InterpolationType interpolationType = ace.InterpolationType.Linear)
 {
     LeftHandle        = new Vector2DF();
     RightHandle       = new Vector2DF();
     KeyValue          = new Vector2DF();
     InterpolationType = interpolationType;
 }
        /// <summary>
        /// 2点間の距離を取得する。
        /// </summary>
        /// <param name="v1">値1</param>
        /// <param name="v2">値2</param>
        /// <returns>距離</returns>
        static float Distance(ref Vector2DF v1, ref Vector2DF v2)
        {
            float dx = v1.X - v2.X;
            float dy = v1.Y - v2.Y;

            return((float)Math.Sqrt(dx * dx + dy * dy));
        }
示例#3
0
 /// <summary>
 /// シーンの最終的な描画内容を表示する三角形を追加する。
 /// </summary>
 /// <param name="pos1">座標1</param>
 /// <param name="uv1">UV1</param>
 /// <param name="col1">色1</param>
 /// <param name="pos2">座標2</param>
 /// <param name="uv2">UV2</param>
 /// <param name="col2">色2</param>
 /// <param name="pos3">座標3</param>
 /// <param name="uv3">UV2</param>
 /// <param name="col3">色3</param>
 public void AddDrawnTriangle(
     ref Vector2DF pos1, ref Vector2DF uv1, ref Color col1,
     ref Vector2DF pos2, ref Vector2DF uv2, ref Color col2,
     ref Vector2DF pos3, ref Vector2DF uv3, ref Color col3)
 {
     CoreScene.AddDrawnTriangle(
         ref pos1, ref uv1, ref col1,
         ref pos2, ref uv2, ref col2,
         ref pos3, ref uv3, ref col3);
 }
        /// <summary>
        /// 行列でベクトルを変形させる。
        /// </summary>
        /// <param name="in_">変形前ベクトル</param>
        /// <returns>変形後ベクトル</returns>
        public Vector2DF Transform2D(ref Vector2DF in_)
        {
            float *values = stackalloc float[4];

            fixed(float *v = Values)
            {
                for (int i = 0; i < 3; i++)
                {
                    values[i]  = 0;
                    values[i] += in_.X * v[i * 3 + 0];
                    values[i] += in_.Y * v[i * 3 + 1];
                    values[i] += 1.0f * v[i * 3 + 2];
                }
            }

            Vector2DF o;

            o.X = values[0];
            o.Y = values[1];
            return(o);
        }
 public void SetVector2DF(string name, Vector2DF value)
 {
     SwigObject.SetVector2DF(name, value);
 }
 /// <summary>
 /// 内積を取得する。
 /// </summary>
 /// <param name="v1">値1</param>
 /// <param name="v2">値2</param>
 /// <returns>内積</returns>
 static float Dot(ref Vector2DF v1, ref Vector2DF v2)
 {
     return(v1.X * v2.X + v1.Y * v2.Y);
 }