Пример #1
0
 public Circle(Vector3 center           = default(Vector3),
               Direction3 direction     = default(Direction3), float radius = 0.5f,
               Matrix4x4?overrideMatrix = null) : this(center, direction, radius,
                                                       (Component)null)
 {
     this._overrideMatrix = overrideMatrix;
 }
Пример #2
0
        /// <summary>
        /// Returns whether two Direction3s point in the same direction without
        /// normalizing either of the underlying vectors.
        ///
        /// This method is intended to cheaply match bit-idential Direction3s; it's
        /// subject to precision error if the magnitudes of the underlying vectors
        /// are very different.
        /// </summary>
        public static bool PointsInSameDirection(Direction3 A, Direction3 B)
        {
            Vector3 aV = new Vector3(A.x, A.y, A.z);
            Vector3 bV = new Vector3(B.x, B.y, B.z);

            return(Vector3.Cross(aV, bV).sqrMagnitude == 0f);
        }
Пример #3
0
 public Circle(Vector3 center            = default(Vector3),
               Direction3 direction      = default(Direction3), float radius = 0.5f,
               Component transformSource = null)
 {
     this.transform       = (transformSource == null ? null : transformSource.transform);
     this.center          = center;
     this.direction       = direction;
     this.radius          = radius;
     this._overrideMatrix = null;
 }
Пример #4
0
 public Plane(Vector3 center, Direction3 normal)
 {
     _cachedCenter          = null;
     _cachedNormal          = null;
     _cachedMatrix          = null;
     _cachedPose            = null;
     _cachedTransformMatrix = null;
     this.center            = center;
     this.normal            = normal;
     this.transform         = null;
 }
Пример #5
0
 private bool checkIsCacheValid()
 {
     return(_cachedPose.HasValue &&
            _cachedCenter.HasValue &&
            _cachedNormal.HasValue &&
            center == _cachedCenter.Value &&
            Direction3.PointsInSameDirection(normal, _cachedNormal.Value) &&
            ((transform == null && !_cachedTransformMatrix.HasValue) ||
             (_cachedTransformMatrix.HasValue &&
              _cachedTransformMatrix.Value == transform.localToWorldMatrix)));
 }
Пример #6
0
 public Circle(Vector3 center       = default(Vector3),
               Direction3 direction = default(Direction3), float radius = 0.5f,
               Transform transform  = null) : this(center, direction, radius,
                                                   (Component)transform)
 {
 }