EgtGeomKernel 1.8d1 :

- inserite le modifiche di Lorenzo a Zmap
- aggiunta a Zmap la possibilità di visualizzare le normali.
This commit is contained in:
Dario Sassi
2017-04-06 07:22:43 +00:00
parent ed16ca5f3a
commit e7b2c55cbb
9 changed files with 4839 additions and 1633 deletions
BIN
View File
Binary file not shown.
+76 -79
View File
@@ -721,120 +721,117 @@ static int TriangleTableEn[256][2][17] = {
{{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, -1},
{1, 6, 10, 2, 1, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 220 */
{{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 8, 4, 5, 1, 3,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
// 220 ----------------------------------------------------------
{{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 8, 4, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 0, 4, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 0, 4, 5, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, -1},
{2, 4, 4, 0, 3, 5, 9, 8, 4, 5, 3, -1, -1, -1, -1, -1, -1}},
{{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, -1},
{2, 4, 4, 0, 3, 5, 9, 8, 4, 5, 3, -1, -1, -1, -1, -1, -1}},
{{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 9,10, 11, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 9, 10, 11, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 225 */
{{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, -1},
{2, 3, 5, 0, 8, 3, 7, 4, 9, 10, 11, -1, -1, -1, -1, -1, -1}},
{{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, -1},
{2, 3, 5, 0, 8, 3, 7, 4, 9, 10, 11, -1, -1, -1, -1, -1, -1}},
{{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, -1},
{1, 6, 1, 10,11, 7, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, -1},
{1, 6, 1, 10, 11, 7, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, -1},
{1, 7, 3, 1,10,11, 7, 4, 8, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, -1},
{1, 7, 3, 1, 10, 11, 7, 4, 8, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, -1},
{2, 4, 4, 2, 11, 9, 1, 4, 9, 11, 7, -1, -1, -1, -1, -1, -1}},
{{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, -1},
{2, 4, 4, 2, 11, 9, 1, 4, 9, 11, 7, -1, -1, -1, -1, -1, -1}},
{{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, -1},
{3, 4, 4, 3, 1, 2, 11, 9, 7, 4, 9,11, 8, 3, 0, 8, 3}},
{{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, -1},
{3, 4, 4, 3, 1, 2, 11, 9, 7, 4, 9, 11, 8, 3, 0, 8, 3}},
/* 230 */
{{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1},
{ 1, 5, 11, 7, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
// 230 ----------------------------------------------------------
{{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 11, 7, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, -1},
{ 2, 4, 4, 11, 7, 4, 2, 3, 2, 4, 8,-1, -1, -1, -1, -1, -1}},
{{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, -1},
{2, 4, 4, 11, 7, 4, 2, 3, 2, 4, 8, -1, -1, -1, -1, -1, -1}},
{{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, -1},
{1, 6, 2, 3, 7, 4, 9,10, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, -1},
{1, 6, 2, 3, 7, 4, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, -1},
{1, 7, 9,10, 2, 0, 8, 7, 4,-1, -1, -1, -1, -1, -1, -1, -1}},
{{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, -1},
{1, 7, 9, 10, 2, 0, 8, 7, 4,-1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, -1},
{1, 7, 3, 7, 4, 0, 1,10, 2, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, -1},
{1, 7, 3, 7, 4, 0, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 235 */
{{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 3, 3, 1,10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{2, 3, 3, 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 4, 9, 1, 3, 7,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 4, 9, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, -1},
{2, 4, 4, 8, 7, 1, 0, 4, 9, 1, 7, -1, -1, -1, -1, -1, -1}},
{{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, -1},
{2, 4, 4, 8, 7, 1, 0, 4, 9, 1, 7, -1, -1, -1, -1, -1, -1}},
{{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 3, 7, 4, 0,-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 3, 7, 4, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 240 */
{{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 8, 9, 10,11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
// 240 ------------------------------------------------------------
{{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 8, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 3, 0, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 3, 0, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 0, 1, 10,11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 0, 1, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 3, 1,10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 3, 1, 10, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 1, 2, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 1, 2, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 245 */
{{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, -1},
{2, 4, 4, 2,11, 9, 1, 3, 0, 9, 11, -1, -1, -1, -1, -1,-1}},
{{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, -1},
{2, 4, 4, 2, 11, 9, 1, 3, 0, 9, 11, -1, -1, -1, -1, -1,-1}},
{{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 0, 2,11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 0, 2, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 2, 3, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 5, 2, 3, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 2, 0, 9,10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 2, 0, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
/* 250 */
{{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, -1},
{2, 4, 4, 2, 3, 8, 10, 1, 10, 8, 0, -1, -1, -1, -1, -1, -1}},
// 250 -------------------------------------------------------
{{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, -1},
{2, 4, 4, 2, 3, 8, 10, 1, 10, 8, 0, -1, -1, -1, -1, -1, -1}},
{{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 1, 3, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 4, 1, 3, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{ 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}
{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}
} ;
#if 0
+395 -30
View File
@@ -26,7 +26,7 @@ using namespace std ;
//----------------------------------------------------------------------------
bool
VolZmap::IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2)
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2) const
{
// Il box è allineato agli assi
@@ -312,7 +312,8 @@ VolZmap::AvoidBox( const Frame3d& frBox, const Vector3d& vtDiag)
bool
VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& CylFrame, double dL, double dR,
Point3d& ptInt1, Point3d& ptInt2)
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapO, bool bTapL)
{
// NB: L'origine del sistema di riferimento deve essere
// nel centro della circonferenza di base e l'asse di simmetria
@@ -323,14 +324,16 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
Point3d ptP = ptLineSt ;
Vector3d vtV = vtLineDir ;
// Trasformazione delle coordinate
// Trasformazione delle coordinate:
// l'asse del cilindro corrisponde con
// l'asse x del sistema di riferimento
ptP.ToLoc( CylFrame) ;
vtV.ToLoc( CylFrame) ;
DBLVECTOR vdCoef(3) ;
DBLVECTOR vdRoots ;
double dSqRad = dR * dR ;
double dSqRad = dR * dR - 2 * dR * EPS_SMALL ;
vdCoef[0] = ptP.y * ptP.y + ptP.z * ptP.z - dSqRad ;
vdCoef[1] = 2 * ( ptP.y * vtV.y + ptP.z * vtV.z) ;
@@ -347,12 +350,18 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
if ( ptInt1.y * ptInt1.y + ptInt1.z * ptInt1.z <= dSqRad &&
ptInt2.y * ptInt2.y + ptInt2.z * ptInt2.z <= dSqRad) {
ptInt1.ToGlob( CylFrame) ;
ptInt2.ToGlob( CylFrame) ;
vtN1.ToGlob( CylFrame) ;
vtN2.ToGlob( CylFrame) ;
return true ;
}
// Nessuna intersezione
@@ -370,31 +379,43 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
if ( nRoot == 2) {
double dEpsO = ( bTapO ? - EPS_SMALL : EPS_SMALL) ;
double dEpsL = ( bTapL ? EPS_SMALL : - EPS_SMALL) ;
ptInt1 = ptP + vdRoots[0] * vtV ;
ptInt2 = ptP + vdRoots[1] * vtV ;
if ( ptInt1.x > ptInt2.x)
swap( ptInt1, ptInt2) ;
swap( ptInt1, ptInt2) ;
vtN1.Set( 0, ( ORIG - ptInt1).y, ( ORIG - ptInt1).z) ;
vtN2.Set( 0, ( ORIG - ptInt2).y, ( ORIG - ptInt2).z) ;
if ( ptInt1.x < dL + EPS_SMALL) {
if ( ptInt1.x < dL + dEpsL) {
if ( ptInt1.x > - EPS_SMALL) {
if ( ptInt1.x > dEpsO) {
if ( ptInt2.x > dL)
if ( ptInt2.x > dL + dEpsL) {
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN2.Set( -1, 0, 0) ;
}
}
else {
if ( ptInt2.x > dL) {
if ( ptInt2.x > dL + dEpsL) {
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1.Set( 1, 0, 0) ;
vtN2.Set( -1, 0, 0) ;
}
else if ( ptInt2.x > 0)
else if ( ptInt2.x > dEpsO) {
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
vtN1.Set( 1, 0, 0) ;
}
else
return false ;
}
@@ -405,7 +426,12 @@ VolZmap::IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
// Riporto le coordinate nel sistema di riferimento griglia
ptInt1.ToGlob( CylFrame) ;
ptInt2.ToGlob( CylFrame) ;
}
vtN1.ToGlob( CylFrame) ;
vtN2.ToGlob( CylFrame) ;
vtN1.Normalize() ;
vtN2.Normalize() ;
}
return true ;
}
@@ -516,11 +542,12 @@ VolZmap::IntersZLineCylinder( const Point3d& ptLine,
}
}
/*
//----------------------------------------------------------------------------
bool
VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& ConusFrame, double dTan, double dl, double dL,
Point3d& ptInt1, Point3d& ptInt2)
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2)
{
// NB: L'origine del sistema di riferimento deve essere
// nel vertice del cono e l'asse di simmetria deve coincidere
@@ -541,6 +568,8 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
double dSqTan = dTan * dTan ;
double dMinRad = dTan * dl ;
double dMaxRad = dTan * dL ;
double dDeltaR = dMaxRad - dMinRad ;
double dHei = dL - dl ;
vdCoef[0] = dSqTan * ptP.x * ptP.x - ptP.y * ptP.y - ptP.z * ptP.z ;
vdCoef[1] = 2 * ( dSqTan * ptP.x * vtV.x - ptP.y * vtV.y - ptP.z * vtV.z) ;
@@ -558,18 +587,32 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
if ( nRoot == 1) {
ptInt1 = ptP + vdRoots[0] * vtV ;
Vector3d vtU = ( ptInt1 - ORIG) - ( ptInt1 - ORIG).x * X_AX ;
vtU.Normalize() ;
vtN1 = dDeltaR * X_AX - dHei * vtU ;
vtN1.Normalize() ;
if ( ptInt1.x < dL + EPS_SMALL) {
if ( ptInt1.x > dl)
if ( ptInt1.x > dl) {
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN2 = - X_AX ;
}
else if ( ptInt1.x > - EPS_SMALL) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
if ( ptInt2.y * ptInt2.y + ptInt2.z * ptInt2.z > dMaxRad * dMaxRad)
return false ;
@@ -580,6 +623,9 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
ptInt1.ToGlob( ConusFrame) ;
ptInt2.ToGlob( ConusFrame) ;
vtN1.ToGlob( ConusFrame) ;
vtN2.ToGlob( ConusFrame) ;
return true ;
}
else
@@ -595,27 +641,46 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
if ( ptInt1.x > ptInt2.x)
swap( ptInt1, ptInt2) ;
Vector3d vtU1 = ( ptInt1 - ORIG) - ( ptInt1 - ORIG).x * X_AX ;
Vector3d vtU2 = ( ptInt2 - ORIG) - ( ptInt2 - ORIG).x * X_AX ;
vtU1.Normalize() ;
vtU2.Normalize() ;
vtN1 = dDeltaR * X_AX - dHei * vtU1 ;
vtN2 = dDeltaR * X_AX - dHei * vtU2 ;
vtN1.Normalize() ;
vtN2.Normalize() ;
if ( ptInt1.x < dL + EPS_SMALL) {
if ( ptInt1.x > dl - EPS_SMALL) {
if ( ptInt2.x > dL)
if ( ptInt2.x > dL) {
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN2 = - X_AX ;
}
}
else if ( ptInt1.x > - EPS_SMALL) {
if ( ptInt2.x > dL) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
}
else if ( ptInt2.x > dl - EPS_SMALL)
else if ( ptInt2.x > dl - EPS_SMALL) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
}
else
return false ;
}
@@ -628,12 +693,16 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
else if ( ptInt2.x < dl) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
}
else if ( ptInt2.x < dL)
else if ( ptInt2.x < dL) {
ptInt1 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = - X_AX ;
}
else
return false ;
}
@@ -641,19 +710,230 @@ VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
ptInt1.ToGlob( ConusFrame) ;
ptInt2.ToGlob( ConusFrame) ;
vtN1.ToGlob( ConusFrame) ;
vtN2.ToGlob( ConusFrame) ;
vtN1.Normalize() ;
vtN2.Normalize() ;
return true ;
}
else
return false ;
}
return false ;
}*/
//----------------------------------------------------------------------------
bool
VolZmap::IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& ConusFrame, double dTan, double dl, double dL,
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapLow, bool bTapUp)
{
// NB: L'origine del sistema di riferimento deve essere
// nel vertice del cono e l'asse di simmetria deve coincidere
// con l'asse x.
// La funzione restituisce true in caso di intersezione,
// false altrimenti.
Point3d ptP = ptLineSt ;
Vector3d vtV = vtLineDir ;
// Trasformazione delle coordinate
ptP.ToLoc( ConusFrame) ;
vtV.ToLoc( ConusFrame) ;
DBLVECTOR vdCoef(3) ;
DBLVECTOR vdRoots ;
double dSqTan = dTan * dTan ;
double dMinRad = dTan * dl ;
double dMaxRad = dTan * dL ;
double dDeltaR = dMaxRad - dMinRad ;
double dHei = dL - dl ;
vdCoef[0] = dSqTan * ptP.x * ptP.x - ptP.y * ptP.y - ptP.z * ptP.z ;
vdCoef[1] = 2 * ( dSqTan * ptP.x * vtV.x - ptP.y * vtV.y - ptP.z * vtV.z) ;
vdCoef[2] = dSqTan * vtV.x * vtV.x - vtV.y * vtV.y - vtV.z * vtV.z ;
// Computo radici
int nRoot = PolynomialRoots( 2, vdCoef, vdRoots) ;
// Nessuna soluzione
if ( nRoot == 0)
return false ;
double dEpsLow = ( bTapLow ? - EPS_SMALL : EPS_SMALL) ;
double dEpsUp = ( bTapUp ? EPS_SMALL : - EPS_SMALL) ;
// Una soluzione: la retta iterseca superficie
// laterale e un piano
if ( nRoot == 1) {
ptInt1 = ptP + vdRoots[0] * vtV ;
Vector3d vtU = ( ptInt1 - ORIG) - ( ptInt1 - ORIG).x * X_AX ;
vtU.Normalize() ;
vtN1 = dDeltaR * X_AX - dHei * vtU ;
vtN1.Normalize() ;
if ( ptInt1.x < dL + dEpsUp) {
if ( ptInt1.x > dl + dEpsLow) {
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN2 = - X_AX ;
}
else if ( ptInt1.x > - EPS_SMALL) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
if ( ptInt2.y * ptInt2.y + ptInt2.z * ptInt2.z > dMaxRad * dMaxRad)
return false ;
}
else
return false ;
ptInt1.ToGlob( ConusFrame) ;
ptInt2.ToGlob( ConusFrame) ;
vtN1.ToGlob( ConusFrame) ;
vtN2.ToGlob( ConusFrame) ;
return true ;
}
else
return false ;
}
// Due soluzioni: la retta interseca due volte la
// superficie laterale
else if ( nRoot == 2) {
ptInt1 = ptP + vdRoots[0] * vtV ;
ptInt2 = ptP + vdRoots[1] * vtV ;
if ( ptInt1.x > ptInt2.x)
swap( ptInt1, ptInt2) ;
Vector3d vtU1 = ( ptInt1 - ORIG) - ( ptInt1 - ORIG).x * X_AX ;
Vector3d vtU2 = ( ptInt2 - ORIG) - ( ptInt2 - ORIG).x * X_AX ;
vtU1.Normalize() ;
vtU2.Normalize() ;
vtN1 = dDeltaR * X_AX - dHei * vtU1 ;
vtN2 = dDeltaR * X_AX - dHei * vtU2 ;
vtN1.Normalize() ;
vtN2.Normalize() ;
if ( abs( vtV.x) < EPS_ZERO) {
if ( ptInt1.x > dl + dEpsLow && ptInt1.x < dL + dEpsUp) {
ptInt1.ToGlob( ConusFrame) ;
ptInt2.ToGlob( ConusFrame) ;
vtN1.ToGlob( ConusFrame) ;
vtN2.ToGlob( ConusFrame) ;
vtN1.Normalize() ;
vtN2.Normalize() ;
return true ;
}
else
return false ;
}
if ( ptInt1.x < dL + dEpsUp) {
if ( ptInt1.x > dl + dEpsLow) {
if ( ptInt2.x > dL + dEpsUp) {
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN2 = - X_AX ;
}
}
else if ( ptInt1.x > - EPS_SMALL) {
if ( ptInt2.x > dL + dEpsUp) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
}
else if ( ptInt2.x > dl + dEpsLow) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
}
else
return false ;
}
else {
if ( ptInt2.x < 0)
return false ;
else if ( ptInt2.x < dl + dEpsLow) {
ptInt1 = ptP + ( ( dl - ptP.x) / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
}
else if ( ptInt2.x < dL + dEpsUp) {
ptInt1 = ptP + ( ( dL - ptP.x) / vtV.x) * vtV ;
vtN1 = - X_AX ;
}
else
return false ;
}
ptInt1.ToGlob( ConusFrame) ;
ptInt2.ToGlob( ConusFrame) ;
vtN1.ToGlob( ConusFrame) ;
vtN2.ToGlob( ConusFrame) ;
vtN1.Normalize() ;
vtN2.Normalize() ;
return true ;
}
else
return false ;
}
return false ;
}
//----------------------------------------------------------------------------
bool
VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d& ptLineSt,
const Frame3d& CircFrame, double dSqRad, double dLongMvLen, double dOrtMvLen,
Point3d& ptInt1, Point3d& ptInt2)
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapLow, bool bTapUp)
{
// NB: L'origine del sistema di riferimento deve essere
// nel centro della circonferenza di base, la cui tralsazione obliqua
@@ -672,6 +952,10 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
Point3d ptP = ptLineSt ;
Vector3d vtV = vtLineDir ;
// Asse cilindro ellittico
Vector3d vtAx( dLongMvLen, dOrtMvLen, 0) ;
vtAx.Normalize() ;
// Trasformazione delle coordinate
ptP.ToLoc( CircFrame) ;
vtV.ToLoc( CircFrame) ;
@@ -700,6 +984,12 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
ptInt1.ToGlob( CircFrame) ;
ptInt2.ToGlob( CircFrame) ;
vtN1 = X_AX ;
vtN2 = - X_AX ;
vtN1.ToGlob( CircFrame) ;
vtN2.ToGlob( CircFrame) ;
return true ;
}
// Nessuna intersezione
@@ -711,10 +1001,15 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
return false ;
}
double dEpsLow = ( bTapLow ? - EPS_SMALL : EPS_SMALL) ;
double dEpsUp = ( bTapUp ? EPS_SMALL : - EPS_SMALL) ;
// L'equazione ammette o due soluzioni (eventualmente
// coincidenti) oppure nessuna o infinite se la la retta
// appartiene alla superficie
Vector3d vtMv( dLongMvLen, dOrtMvLen, 0) ;
if ( nRoot == 2) {
ptInt1 = ptP + vdRoots[0] * vtV ;
@@ -725,30 +1020,73 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
swap( ptInt1, ptInt2) ;
Vector3d vtTest1 = ( ptInt1 - ORIG) - ( ptInt1 - ORIG) * vtAx * vtAx ;
Vector3d vtTest2 = ( ptInt2 - ORIG) - ( ptInt2 - ORIG) * vtAx * vtAx ;
if ( ptInt1.x < dLongMvLen + EPS_SMALL) {
double dY0_1, dY0_2 ;
if ( ptInt1.x > - EPS_SMALL) {
if ( vtTest1.y > 0) {
if ( ptInt2.x > dLongMvLen)
dY0_1 = ( dSqRad - ptInt1.z * ptInt1.z > 0 ? sqrt( dSqRad - ptInt1.z * ptInt1.z) : 0) ;
}
else {
dY0_1 = ( dSqRad - ptInt1.z * ptInt1.z > 0 ? - sqrt( dSqRad - ptInt1.z * ptInt1.z) : 0) ;
}
Vector3d vtCirc1( 0, - dY0_1, - ptInt1.z) ;
Vector3d vtTan1( 0, - vtCirc1.z, vtCirc1.y) ;
Vector3d vtCross1 = vtTan1 ^ vtMv ;
vtN1 = ( vtCross1 * vtCirc1 > 0 ? vtCross1 : - vtCross1) ;
if ( vtTest2.y > 0) {
dY0_2 = ( dSqRad - ptInt2.z * ptInt2.z > 0 ? sqrt( dSqRad - ptInt2.z * ptInt2.z) : 0) ;
}
else {
dY0_2 = ( dSqRad - ptInt2.z * ptInt2.z > 0 ? - sqrt( dSqRad - ptInt2.z * ptInt2.z) : 0) ;
}
Vector3d vtCirc2( 0, - dY0_2, - ptInt2.z) ;
Vector3d vtTan2( 0, - vtCirc2.z, vtCirc2.y) ;
Vector3d vtCross2 = vtTan2 ^ vtMv ;
vtN2 = ( vtCross2 * vtCirc2 > 0 ? vtCross2 : - vtCross2) ;
if ( ptInt1.x < dLongMvLen + dEpsUp) {
if ( ptInt1.x > + dEpsLow) {
if ( ptInt2.x > dLongMvLen + dEpsUp) {
ptInt2 = ptP + ( ( dLongMvLen - ptP.x) / vtV.x) * vtV ;
vtN2 = - X_AX ;
}
}
else {
if ( ptInt2.x > dLongMvLen) {
if ( ptInt2.x > dLongMvLen + dEpsUp) {
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
ptInt2 = ptP + ( ( dLongMvLen - ptP.x) / vtV.x) * vtV ;
vtN1.Set( 1, 0, 0) ;
vtN2.Set( -1, 0, 0) ;
if ( ptInt1.y * ptInt1.y + ptInt1.z * ptInt1.z > dSqRad &&
ptInt2.y * ptInt2.y + ptInt2.z * ptInt2.z > dSqRad)
return false ;
}
else if ( ptInt2.x > 0)
else if ( ptInt2.x > dEpsLow) {
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
ptInt1 = ptP - ( ptP.x / vtV.x) * vtV ;
vtN1.Set( 1, 0, 0) ;
}
else
return false ;
}
@@ -760,6 +1098,12 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
// griglia
ptInt1.ToGlob( CircFrame) ;
ptInt2.ToGlob( CircFrame) ;
vtN1.ToGlob( CircFrame) ;
vtN2.ToGlob( CircFrame) ;
vtN1.Normalize() ;
vtN2.Normalize() ;
}
return true ;
@@ -769,7 +1113,7 @@ VolZmap::IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d&
bool
VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaX,
Point3d& ptInt1, Point3d& ptInt2)
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2)
{
double SqIndet = EPS_SMALL * EPS_SMALL ;
@@ -793,6 +1137,8 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
Vector3d vtOb( dLenY, - dDeltaX, 0) ;
vtOb.Normalize() ;
Point3d ptI1 = ptP + ( ( ptFacet135.z - ptP.z) / vtV.z) * vtV ;
Point3d ptI2 = ptP + ( ( ptFacet246.z - ptP.z) / vtV.z) * vtV ;
Point3d ptI3 = ptP + ( ( ptFacet135.y - ptP.y) / vtV.y) * vtV ;
@@ -800,6 +1146,11 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
Point3d ptI5 = ptP + ( ( vtFacet5 * vtOb) / ( vtV * vtOb)) * vtV ;
Point3d ptI6 = ptP + ( ( vtFacet6 * vtOb) / ( vtV * vtOb)) * vtV ;
if ( abs( vtV.z) < EPS_ZERO &&
abs( ptP.z) > dLenZ / 2 - EPS_SMALL)
return false ;
int nIntNum = 0 ;
// Intersezione con la prima faccia
@@ -807,6 +1158,7 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
ptI1.x * dLenY >= dDeltaX * ptI1.y && ( ptI1.x - dLenX) * dLenY <= dDeltaX * ptI1.y) {
ptInt1 = ptI1 ;
vtN1 = - Z_AX ;
++ nIntNum ;
}
@@ -817,11 +1169,13 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
if ( nIntNum == 0) {
ptInt1 = ptI2 ;
vtN1 = Z_AX ;
++ nIntNum ;
}
else if ( ( ptInt1 - ptI2).SqLen() > SqIndet) {
ptInt2 = ptI2 ;
vtN2 = Z_AX ;
++ nIntNum ;
}
}
@@ -834,11 +1188,13 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
if ( nIntNum == 0) {
ptInt1 = ptI3 ;
vtN1 = Y_AX ;
++ nIntNum ;
}
else if ( ( ptInt1 - ptI3).SqLen() > SqIndet) {
ptInt2 = ptI3 ;
vtN2 = Y_AX ;
++ nIntNum ;
}
}
@@ -851,11 +1207,13 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
if ( nIntNum == 0) {
ptInt1 = ptI4 ;
vtN1 = - Y_AX ;
++ nIntNum ;
}
else if ( ( ptInt1 - ptI4).SqLen() > SqIndet) {
ptInt2 = ptI4 ;
vtN2 = - Y_AX ;
++ nIntNum ;
}
}
@@ -868,11 +1226,13 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
if ( nIntNum == 0) {
ptInt1 = ptI5 ;
vtN1 = vtOb ;
++ nIntNum ;
}
else if ( ( ptInt1 - ptI5).SqLen() > SqIndet) {
ptInt2 = ptI5 ;
vtN2 = vtOb ;
++ nIntNum ;
}
}
@@ -885,11 +1245,13 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
if ( nIntNum == 0) {
ptInt1 = ptI6;
vtN1 = - vtOb ;
++ nIntNum ;
}
else if ( ( ptInt1 - ptI6).SqLen() > SqIndet) {
ptInt2 = ptI6;
vtN2 = - vtOb ;
++ nIntNum ;
}
}
@@ -900,6 +1262,9 @@ VolZmap::IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLine
ptInt1.ToGlob( PolyFrame) ;
ptInt2.ToGlob( PolyFrame) ;
vtN1.ToGlob( PolyFrame) ;
vtN2.ToGlob( PolyFrame) ;
return true ;
}
else
+2 -2
View File
@@ -286,8 +286,8 @@ VolZmap::CreateFromFlatRegion( const ISurfFlatRegion& Surf, double dDimZ, double
if ( nType == CRVC_IN || nType == CRVC_ON_P || nType == CRVC_ON_M) {
// Indici corrispondenti alle coordinate dei punti
int nStartJ = Clamp( int( floor( dt1 * dLengthY / m_dStep + 0.5)), 0, m_nNy[0] - 1) ; // CAMBIATO CON EPS
int nEndJ = Clamp( int( floor( dt2 * dLengthY / m_dStep - 0.5)), 0, m_nNy[0] - 1) ; // CAMBIATO CON EPS
int nStartJ = Clamp( int( floor( dt1 * dLengthY / m_dStep - EPS_SMALL + 0.5)), 0, m_nNy[0] - 1) ; // CAMBIATO CON EPS
int nEndJ = Clamp( int( floor( dt2 * dLengthY / m_dStep + EPS_SMALL - 0.5)), 0, m_nNy[0] - 1) ; // CAMBIATO CON EPS
// Ridimensiono e riempio i dexel
for ( int j = nStartJ ; j <= nEndJ ; ++ j) {
+1447 -384
View File
File diff suppressed because it is too large Load Diff
+2784 -1105
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -142,7 +142,7 @@ VolZmap::GetType( void) const
const string&
VolZmap::GetTitle( void) const
{
static const string sTitle = "VolZm" ;
static const string sTitle = "Zmap" ;
return sTitle ;
}
+35 -19
View File
@@ -26,8 +26,8 @@
//----------------------------------------------------------------------------
struct TriaStruct {
int i, j, k ;
Point3d ptVert ;
TRIA3DVECTOR vecTria ;
std::vector<Point3d> ptCompoVert ;
std::vector<TRIA3DVECTOR> vCompoTria ;
} ;
typedef std::vector <TriaStruct> TriHolder ;
@@ -117,14 +117,15 @@ class VolZmap : public IVolZmap, public IGeoObjRW
const Vector3d& vtZ, const Vector3d& vtNorm, TRIA3DLIST& lstTria) const ;
bool MarchingCubes( TRIA3DLIST& lstTria) const ;
bool MarchingCubes( int nBlock, TRIA3DLIST& lstTria) const ;
bool ExtMarchingCubes( int nBlock, TRIA3DLIST& lstTria, TriHolder& triHold) const ;
bool ExtMarchingCubes( const int nLimits[], TRIA3DLIST& lstTria, TriHolder& triHold) const ;
bool ExtMarchingCubes( const std::vector <int> VoxelsIndexes, TriHolder& triHold) const ;
bool FlipEdges( TriHolder& triHold) const ;
bool FlipEdges( int nBlock, TriHolder& triHold) ;
bool FlipEdges( int nNumBlocks, int nBlocks[], TriHolder triHold []) ;
bool FlipEdgesLocalFlipEdges( TriaStruct& triStrCurr, TriaStruct& triStrAdj) const ;
bool IsThereMat( int nI, int nJ, int nK) const ;
bool IsThereMat( const int nMatr[][3], int nNum, double & dHx, double & dHy, double & dHz) const ;
bool IntersPos( int nVec1[], int nVec2[], Point3d & ptInt) const ;
bool IntersPos( int nVec1[], int nVec2[], Point3d & ptInt, Vector3d & vtNormal) const ;
bool NewIntersPos( int nVec1[], int nVec2[], bool bFirstCorner, Point3d& ptInt, Vector3d& vtNormal) const ;
// OPERAZIONI SU INTERVALLI
bool SubtractIntervals( unsigned int nGrid, unsigned int nI, unsigned int nJ,
@@ -176,22 +177,30 @@ class VolZmap : public IVolZmap, public IGeoObjRW
// Asse di simmetria diretto come l'asse Z
// Drilling
bool CompCyl_ZDrilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dRad) ;
bool CompConus_ZDrilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
bool CompCyl_ZDrilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir,
double dHei, double dRad) ;
bool CompConus_ZDrilling( unsigned int nGrid, const Point3d& ptLs, const Point3d& ptLe, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad) ;
// Milling
bool CompCyl_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dRad) ;
bool CompConus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
bool CompCyl_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad) ;
bool CompConus_ZMilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad) ;
// Asse di simmetria con orientazione generica
// Drilling
bool CompCyl_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dRad) ;
bool CompConus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
bool CompCyl_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bTapB, bool bTapT) ;
bool CompConus_Drilling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
// Milling
bool CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dRad) ;
bool CompConus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir, double dHei, double dMaxRad, double dMinRad) ;
bool CompCyl_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dRad, bool bTapB, bool bTapT) ;
bool CompConus_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, const Vector3d& vtToolDir,
double dHei, double dMaxRad, double dMinRad, bool bTapB, bool bTapT) ;
// Generica traslazione sfera
bool CompBall_Milling( unsigned int nGrid, const Point3d& ptS, const Point3d& ptE, double dRad) ;
@@ -205,7 +214,7 @@ class VolZmap : public IVolZmap, public IGeoObjRW
// Intersezioni
bool IntersLineBox( const Point3d& ptP, const Vector3d& vtV,
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2) ;
const Point3d& ptMin, const Point3d& ptMax, double& dU1, double& dU2) const ;
bool IntersLineZMapBBox( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, double& dU1, double& dU2) ;
bool IntersLineDexel( unsigned int nGrid, const Point3d& ptP, const Vector3d& vtV, unsigned int nI, unsigned int nJ,
double& dU1, double& dU2) ;
@@ -214,27 +223,34 @@ class VolZmap : public IVolZmap, public IGeoObjRW
double& dU1, double& dU2) ;
bool IntersLineCylinder( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& CylFrame, double dL, double dR,
Point3d& ptInt1, Point3d& ptInt2) ;
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapO, bool bTapL) ;
bool IntersZLineCylinder( const Point3d& ptLine,
const Point3d& ptBase, const Point3d& ptTop, double dCylR,
double& dInfZ, double& dSupZ) ;
bool IntersLineEllipticalCylinder( const Vector3d& vtLineDir, const Point3d& ptLineSt,
const Frame3d& CircFrame, double dSqRad, double dLongMvLen, double dOrtMvLen,
Point3d& ptInt1, Point3d& ptInt2) ;
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapLow, bool bTapUp) ;
bool IntersLineConus( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& ConusFrame, double dTan, double dl, double dL,
Point3d& ptInt1, Point3d& ptInt2) ;
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2,
bool bTapLow, bool bTapUp) ;
bool IntersLineSphere( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Point3d& ptCenter, double dRad,
Point3d& ptInt1, Point3d& ptInt2) ;
bool IntersLineMyPolyhedron( const Point3d& ptLineSt, const Vector3d& vtLineDir,
const Frame3d& PolyFrame, double dLenX, double dLenY, double dLenZ, double dDeltaX,
Point3d& ptInt1, Point3d& ptInt2) ;
Point3d& ptInt1, Point3d& ptInt2, Vector3d& vtN1, Vector3d& vtN2) ;
// Funzioni di gestione dei blocchi
bool GetBlockIJK( int nIJK[], int nBlock) const ;
bool GetBlockLimitsIJK( const int nIJK[], int nLimits[]) const ;
private :
enum Status { ERR = 0, OK = 1, TO_VERIFY = 2} ;
static const int N_MAPS = 3 ;
static const int N_DEXBLOCK = 32 ;
static const int N_DEXBLOCK = 32;//20;//32 ;
private :
ObjGraphicsMgr m_OGrMgr ; // gestore grafica dell'oggetto
+99 -13
View File
@@ -17,6 +17,8 @@
#include "CurveArc.h"
#include "VolZmap.h"
#include "GeoConst.h"
#include "\EgtDev\Include\EGKLinePntTgCurve.h"
#include "\EgtDev\Include\EGKFilletChamfer.h"
using namespace std ;
@@ -100,24 +102,108 @@ VolZmap::SetAdvTool( const string& sToolName, double dH, double dR,
if ( dH < EPS_SMALL || dR < EPS_SMALL)
return false ;
// se altezza punta nulla, ricado nel caso standard
if ( dTipH < EPS_SMALL)
if ( dTipH < EPS_SMALL || abs( dTipR - dR) < EPS_SMALL)
return SetStdTool( sToolName, dH, dR, dCornR) ;
// caso avanzato
if ( abs( dTipR - dR) < EPS_SMALL) {
m_nToolType = CylindricalMill ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dTipHeight = 0 ;
m_dTipRadius = m_dRadius ;
m_dRCorner = 0 ;
}
// caso avanzato
else {
m_nToolType = ConusMill ;
m_dHeight = dH ;
m_dRadius = dR ;
m_dTipHeight = dTipH ;
m_dTipRadius = max( dTipR, 0.) ;
m_dRCorner = dCornR ;
if ( dCornR < EPS_SMALL) {
m_nToolType = ConusMill ;
m_dRCorner = 0 ;
}
// Se il raggio corner è non nullo
// l'utensile viene descritto da
// come utensile generico.
else {
m_dRCorner = dCornR ;
m_nToolType = GenericTool ;
// come profilo
m_nToolType = GenericTool ;
Point3d pt0( 0, 0, 0) ;
Point3d pt1( m_dRadius, 0, 0) ;
Point3d pt2( m_dRadius, - m_dHeight + m_dTipHeight, 0) ;
if ( m_dTipRadius < m_dRadius) {
Point3d ptInt( dTipR, - dH, 0) ;
Point3d ptLast( 0, - dH, 0) ;
CurveLine cLine1 ; cLine1.Set( pt2, ptInt) ;
CurveLine cLine2 ; cLine2.Set( ptInt, ptLast) ;
double dTrim1, dTrim2 ;
Point3d ptIn1 = ptInt + Y_AX * dCornR ;
Point3d ptIn2 = ptInt - X_AX * dCornR ;
ICurveArc* pArc = CreateFillet( cLine1, ptIn1, cLine2, ptIn2, Z_AX, dCornR, dTrim1, dTrim2) ;
cLine1.TrimEndAtParam( abs( dTrim1)) ;
cLine2.TrimStartAtParam( abs( dTrim2)) ;
Point3d pt3, pt4 ;
cLine1.GetEndPoint( pt3) ;
cLine2.GetStartPoint( pt4) ;
Point3d ptC = pArc -> GetCenter() ;
CurveArc cvArc ; cvArc.SetC2P( ptC, pt3, pt4) ;
m_ToolOutline.Clear() ;
CurveLine LineSt ; LineSt.Set( pt0, pt1) ;
m_ToolOutline.AddCurve( LineSt) ;
m_ToolOutline.AddLine( pt2);
m_ToolOutline.AddLine( pt3);
m_ToolOutline.AddCurve( cvArc) ;
m_ToolOutline.AddLine( ptLast) ;
}
else {
if ( dTipR - dCornR < 0)
return false ;
Point3d ptC( dTipR - dCornR, - dH + dCornR, 0) ;
CurveArc cvCirc ; cvCirc.SetXY( ptC, dCornR) ;
Point3d ptNear( ptC.x + dCornR, ptC.y + dCornR, 0) ;
ICurveLine* pLine = GetLinePointTgCurve( pt2, cvCirc, ptNear) ;
Point3d pt3 ;
pLine -> GetEndPoint( pt3) ;
Point3d pt4( ptC.x, - dH, 0) ;
CurveArc cvArc ; cvArc.SetC2P( ptC, pt3, pt4) ;
Point3d pt5( 0, - dH, 0) ;
m_ToolOutline.Clear() ;
CurveLine Line ; Line.Set( pt0, pt1) ;
m_ToolOutline.AddCurve( Line) ;
m_ToolOutline.AddLine( pt2);
m_ToolOutline.AddLine( pt3);
m_ToolOutline.AddCurve( cvArc) ;
m_ToolOutline.AddLine( pt5) ;
}
return SetGenTool( sToolName, &m_ToolOutline) ;
}
}
// assegno il nome
m_sToolName = sToolName ;
@@ -146,7 +232,7 @@ VolZmap::SetGenTool( const string& sToolName, const ICurveComposite* pToolOutlin
// Ciclo sulle curve componenti
while ( pCurve != nullptr) {
// Se la curva è un arco valuto approssimarlo
// Se la curva è un arco valuto se approssimarlo
if ( pCurve->GetType() == CRV_ARC) {
// Centro e punti iniziale e finale dell'arco