Beispiel #1
0
 public void SetFromZ(ref Vec3f z)
 {
     Vec3f tmpZ = mZ = Vector.Normalize(z);
     Vec3f tmpX = (Math.Abs(tmpZ.x) > 0.99f) ? new Vec3f(0, 1, 0) : new Vec3f(1, 0, 0);
     mY = Vector.Normalize(Vector.Cross(ref tmpZ, ref tmpX));
     mX = Vector.Cross(ref mY, ref tmpZ);
 }
Beispiel #2
0
 public static void vecAdd (Vec3f* a, Vec3f* b, Vec3f* ptr) {
   vecStore(
     a->x + b->x, 
     a->y + b->y, 
     a->z + b->z, 
     ptr
   );    
 }
Beispiel #3
0
 public static void vecScale (Vec3f* a, float scale, Vec3f* ptr) {
   vecStore(
     a->x * scale, 
     a->y * scale, 
     a->z * scale, 
     ptr
   );    
 }
Beispiel #4
0
 public ONB(
     Vec3f x,
      Vec3f y,
      Vec3f z)
 {
     mX = x;
     mY = y;
     mZ = z;
 }
    private IEnumerator DrawLine(Vec3f[] traj, LineRenderer lr)
    {
        lr.SetVertexCount(traj.Length);

        for (int i = 0; i < traj.Length; ++i) {
            lr.SetPosition(i, new Vector3(float.NaN, float.NaN, float.NaN));
        }

        for (int i = 0; i < traj.Length; ++i) {
            lr.SetPosition(i, Trans(traj[i]));
            yield return new WaitForSeconds(0.05f);
        }
    }
Beispiel #6
0
 public MakeShadowTest()
 {
     this.sizeofMat = 6;
     this.package = new ShadowPackage();
     this.rnd = new Random();
     this.center = new Point3f();
     this.shadowCalor = new Scalar[sizeofMat];
     this.players = new _playrer[sizeofMat];
     this.pt = new Point[sizeofMat];
     this.kinect = KinectSensor.GetDefault();
     this.joints = new Joint[this.sizeofMat];
     this.moveCenter = new Point3f();
     this.vecofCenter = new Vec3f();
     this.param = new Parameter();
 }
Beispiel #7
0
 public static void vecStore (float x, float y, float z, Vec3f* ptr) {
   ptr->x = x;
   ptr->y = y;
   ptr->z = z;
 }
Beispiel #8
0
 public static void sampleEnv (Vec3f* dir, Vec3f* ptr) {
   var y = dir->y;
   var amt = y * 0.5f + 0.5f;
   var keep = 1.0f - amt;
   vecStore(
     keep * 0.1f + amt * 0.1f, 
     keep * 1.0f + amt * 0.1f, 
     keep * 0.1f + amt * 1.0f, 
     ptr
   );
 }
Beispiel #9
0
 public static float vecNLDot (Vec3f* a, Vec3f* b) {
   var value = vecDot(a, b);
   if (value < 0)
     return 0;
   else
     return value;
 }
Beispiel #10
0
 public static float vecDot (Vec3f* a, Vec3f* b) {
   return (a->x * b->x) + (a->y * b->y) + (a->z * b->z);
 }
Beispiel #11
0
  public static float vecLen (Vec3f* ptr) {
    var x = ptr->x;
    var y = ptr->y;
    var z = ptr->z;

    return fsqrt((x * x) + (y * y) + (z * z));
  }
Beispiel #12
0
  public static void vecNormalize (Vec3f* ptr) {
    var x = ptr->x;
    var y = ptr->y;
    var z = ptr->z;

    float invLen = 1.0f / fsqrt((x * x) + (y * y) + (z * z));
    vecStore(x * invLen, y * invLen, z * invLen, ptr);
  }
Beispiel #13
0
 public Vec3f ToWorld(ref Vec3f a)
 {
     return mX * a.x + mY * a.y + mZ * a.z;
 }
Beispiel #14
0
 public Vec3f ToLocal(ref Vec3f a)
 {
     return new Vec3f(Vector.Dot(ref a, ref mX), Vector.Dot(ref a, ref mY), Vector.Dot(ref a, ref mZ));
 }
Beispiel #15
0
 public Ray(Vec3f origin, Vec3f direction)
 {
     Origin = origin;
     Direction = direction;
 }
Beispiel #16
0
 public void setTargetVelocity( Vec3f vel )
 {
     this.walkVelocityMeterPerSec = vel.__data[2];
 }
Beispiel #17
0
 public void setTargetUpVelocity(Vec3f vel)
 {
     // RedirectToFrontNavigationMediator in Radiant, WiiTurnNavigationMediator auch
     this.upVelocityDegPerSec = vel[1] * Mathf.Rad2Deg;
 }
 public static Vec3f Cos(Vec3f radians)
 {
     return new Vec3f()
     {
         x = (float)Math.Cos(radians.x),
         y = (float)Math.Cos(radians.y),
         z = (float)Math.Sin(radians.z)
     };
 }
 private Vector3 Trans(Vec3f vec)
 {
     return vec * (true ? 50f : 0.1f) + (Vec3f.UnitZ * 100f);
 }
 public static extern void core_Mat_push_back_Vec3f(IntPtr self, Vec3f v);
Beispiel #21
0
        /// <summary>
        /// converts point coordinates from homogeneous to normal pixel coordinates ((x,y,z)->(x/z, y/z))
        /// </summary>
        /// <param name="src">Input vector of N-dimensional points.</param>
        /// <returns>Output vector of N-1-dimensional points.</returns>
        public static Vec3f[] ConvertPointsFromHomogeneous(IEnumerable<Vec4f> src)
        {
            if (src == null)
                throw new ArgumentNullException("src");

            Vec4f[] srcA = EnumerableEx.ToArray(src);
            Vec3f[] dstA = new Vec3f[srcA.Length];
            NativeMethods.calib3d_convertPointsFromHomogeneous_array2(srcA, dstA, srcA.Length);
            return dstA;
        }
Beispiel #22
0
 public ONB()
 {
     mX = new Vec3f(1, 0, 0);
     mY = new Vec3f(0, 1, 0);
     mZ = new Vec3f(0, 0, 1);
 }