Intersect() 공개 메소드

public Intersect ( Plane _p0, Plane _p1, float3 &_intersection ) : bool
_p0 Plane
_p1 Plane
_intersection float3
리턴 bool
예제 #1
0
        // Intersection between 3 planes
        public bool                             Intersect(Plane _p0, Plane _p1, ref float3 _intersection)
        {
            // Compute the intersection of 2 planes first, yielding a ray
            Ray Hit = new Ray();

            if (!_p0.Intersect(_p1, Hit))
            {
                return(false);
            }

            // Then compute the intersection of this ray with our plane
            return(Intersect(Hit, ref _intersection));
        }
예제 #2
0
        // Intersection between 2 planes
        public bool                                     Intersect(Plane _p, Ray _ray)
        {
            // Check if both planes are coplanar
            if ((float)System.Math.Abs(1.0f - _p.n.Dot(n)) < float.Epsilon)
            {
                return(false);
            }

            // Let's have fun!
            float3 I = new float3();

            _ray.Pos.Set(0, 0, 0);
            _ray.Aim = n;
            if (!_p.Intersect(_ray, ref I))
            {
                return(false);
            }

            _ray.Aim = _p.n;
            if (!_p.Intersect(_ray, ref I))
            {
                return(false);
            }
            _ray.Pos = I;

            _ray.Aim = I - _ray.Pos;
            if (!Intersect(_ray, ref I))
            {
                return(false);
            }
            _ray.Pos = I;

            // We have at least one point belonging to both planes!
            _ray.Aim = n.Cross(_p.n).Normalized;

            return(true);
        }
예제 #3
0
파일: Plane.cs 프로젝트: Patapom/GodComplex
        // Intersection between 2 planes
        public bool Intersect( Plane _p, Ray _ray )
        {
            // Check if both planes are coplanar
            if ( (float) System.Math.Abs( 1.0f - _p.n.Dot(n) ) < float.Epsilon )
                return	false;

            // Let's have fun!
            float3	I = new float3();
            _ray.Pos.Set( 0, 0, 0 );
            _ray.Aim = n;
            if ( !_p.Intersect( _ray, ref I ) )
                return	false;

            _ray.Aim = _p.n;
            if ( !_p.Intersect( _ray, ref I ) )
                return	false;
            _ray.Pos = I;

            _ray.Aim = I - _ray.Pos;
            if ( !Intersect( _ray, ref I ) )
                return	false;
            _ray.Pos = I;

            // We have at least one point belonging to both planes!
            _ray.Aim = n.Cross(_p.n).Normalized;

            return	true;
        }
예제 #4
0
파일: Plane.cs 프로젝트: Patapom/GodComplex
        // Intersection between 3 planes
        public bool Intersect( Plane _p0, Plane _p1, ref float3 _intersection )
        {
            // Compute the intersection of 2 planes first, yielding a ray
            Ray		Hit = new Ray();
            if ( !_p0.Intersect( _p1, Hit ) )
                return	false;

            // Then compute the intersection of this ray with our plane
            return Intersect( Hit, ref _intersection );
        }