Intersect() public method

public Intersect ( Plane _p0, Plane _p1, float3 &_intersection ) : bool
_p0 Plane
_p1 Plane
_intersection float3
return bool
Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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 );
        }