#include "ray.h"
#include "../../3d_fastmath.h"
#include <cstdio>
#include <wx/debug.h>
#include <wx/log.h>
#include <cmath>
Go to the source code of this file.
◆ IntersectSegment()
bool IntersectSegment |
( |
const SFVEC2F & |
aStartA, |
|
|
const SFVEC2F & |
aEnd_minus_startA, |
|
|
const SFVEC2F & |
aStartB, |
|
|
const SFVEC2F & |
aEnd_minus_startB |
|
) |
| |
Definition at line 187 of file ray.cpp.
190 float rxs = aEnd_minus_startA.x * aEnd_minus_startB.y - aEnd_minus_startA.y *
193 if( std::abs( rxs ) > glm::epsilon<float>() )
195 float inv_rxs = 1.0f / rxs;
197 SFVEC2F pq = aStartB - aStartA;
199 float t = ( pq.x * aEnd_minus_startB.y - pq.y * aEnd_minus_startB.x ) * inv_rxs;
201 if( ( t < 0.0f ) || ( t > 1.0f ) )
204 float u = ( pq.x * aEnd_minus_startA.y - pq.y * aEnd_minus_startA.x ) * inv_rxs;
206 if( ( u < 0.0f ) || ( u > 1.0f ) )
Referenced by ROUND_SEGMENT_2D::Intersects().