Files
EgtGeomKernel/IntersPlanePlane.cpp
T
Dario Sassi 9770d57793 EgtGeomKernel :
- tolta da ChainCurves riduzione tolleranza con dimensione pezzi
- aggiunte DistPointTriangle, IntersPlaneTria, IntersPlaneSurfTm
- correzioni a IntersCrvCompoCrvCompo per topologia intersezioni
- completamente riscritta IntersCoplanarLineTria per robustezza topologica.
2017-10-21 17:01:23 +00:00

47 lines
1.9 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2017-2017
//----------------------------------------------------------------------------
// File : IntersPlanePlane.cpp Data : 15.10.17 Versione : 1.8j3
// Contenuto : Implementazione della intersezione piano/piano.
//
//
//
// Modifiche : 15.10.17 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "/EgtDev/Include/EGkIntersPlanePlane.h"
#include "/EgtDev/Include/EGkIntersLinePlane.h"
//----------------------------------------------------------------------------
int
IntersPlanePlane( const Plane3d& plPlane1, const Plane3d& plPlane2, Point3d& ptInt, Vector3d& vtDir)
{
// Direzione linea di intersezione
vtDir = plPlane1.GetVersN() ^ plPlane2.GetVersN() ;
// Verifico se piani praticamente paralleli
double dDenom = vtDir * vtDir ;
if ( dDenom < EPS_ZERO * EPS_ZERO)
return ( abs( plPlane1.GetDist() - plPlane2.GetDist()) < EPS_SMALL ? IPPT_OVERLAPS : IPPT_NO) ;
// Calcolo un punto sulla retta di intersezione
ptInt = ORIG + ( ( plPlane1.GetDist() * plPlane2.GetVersN() - plPlane2.GetDist() * plPlane1.GetVersN()) ^ vtDir) / dDenom ;
// Normalizzo la direzione
vtDir.Normalize() ;
return IPPT_YES ;
}
//----------------------------------------------------------------------------
int
Inters3Planes( const Plane3d& plPlane1, const Plane3d& plPlane2, const Plane3d& plPlane3, Point3d& ptInt)
{
// linea di intersezione tra i primi due piani
Point3d ptL ; Vector3d vtL ;
if ( IntersPlanePlane( plPlane1, plPlane2, ptL, vtL) != IPPT_YES)
return IPPT_NO ;
// intersezione della linea con il terzo piano
return ( IntersLinePlane( ptL, vtL, 1, plPlane3, ptInt) == ILPT_YES ? IPPT_YES : IPPT_NO) ;
}