Implement MeshOptimizeSTLSurface::ProjectPointGI

This commit is contained in:
Matthias Hochsteger 2019-10-08 13:46:27 +02:00
parent fea75d6ff5
commit 865aca0ba0
3 changed files with 80 additions and 63 deletions

View File

@ -1080,6 +1080,22 @@ void MeshOptimizeSTLSurface :: ProjectPoint (INDEX surfind, Point<3> & p) const
// geometry.GetSurface(surfind)->Project (p); // geometry.GetSurface(surfind)->Project (p);
} }
int MeshOptimizeSTLSurface :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
{
int meshchart = geom.GetChartNr(gi.trignum);
const STLChart& chart = geom.GetChart(meshchart);
int trignum = chart.ProjectNormal(p);
if(trignum==0)
{
PrintMessage(7,"project failed");
geom.SelectChartOfTriangle (gi.trignum); // needed because ProjectOnWholeSurface uses meshchartnv (the normal vector of selected chart)
trignum = geom.ProjectOnWholeSurface(p);
if(trignum==0)
PrintMessage(7, "project on whole surface failed");
}
return trignum;
}
void MeshOptimizeSTLSurface :: ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const void MeshOptimizeSTLSurface :: ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const
{ {
/* /*
@ -1101,8 +1117,7 @@ int MeshOptimizeSTLSurface :: CalcPointGeomInfo(PointGeomInfo& gi, const Point<
void MeshOptimizeSTLSurface :: GetNormalVector(INDEX surfind, const Point<3> & p, PointGeomInfo & gi, Vec<3> & n) const void MeshOptimizeSTLSurface :: GetNormalVector(INDEX surfind, const Point<3> & p, PointGeomInfo & gi, Vec<3> & n) const
{ {
geom.SelectChartOfTriangle (gi.trignum); n = geom.GetTriangle(gi.trignum).Normal();
n = geom.GetChartNormalVector();
} }

View File

@ -78,6 +78,8 @@ public:
/// ///
void ProjectPoint (INDEX surfind, Point<3> & p) const override; void ProjectPoint (INDEX surfind, Point<3> & p) const override;
/// ///
int ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const override;
///
void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const override; void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point<3> & p) const override;
/// ///
int CalcPointGeomInfo(PointGeomInfo& gi, const Point<3> & p3) const override; int CalcPointGeomInfo(PointGeomInfo& gi, const Point<3> & p3) const override;

View File

@ -687,43 +687,43 @@
"ne1d": 456, "ne1d": 456,
"ne2d": 1230, "ne2d": 1230,
"ne3d": 1990, "ne3d": 1990,
"quality_histogram": "[0, 0, 0, 0, 1, 2, 3, 9, 21, 47, 69, 116, 164, 237, 326, 280, 298, 225, 151, 41]", "quality_histogram": "[0, 0, 0, 0, 0, 2, 2, 13, 19, 39, 60, 137, 183, 248, 311, 282, 280, 231, 136, 47]",
"total_badness": 2772.6154636 "total_badness": 2776.6730441
}, },
{ {
"ne1d": 298, "ne1d": 298,
"ne2d": 608, "ne2d": 610,
"ne3d": 770, "ne3d": 793,
"quality_histogram": "[0, 0, 0, 1, 10, 9, 19, 15, 35, 46, 62, 87, 79, 89, 83, 87, 64, 45, 30, 9]", "quality_histogram": "[0, 0, 0, 3, 10, 12, 25, 19, 34, 52, 79, 76, 93, 95, 86, 82, 58, 40, 22, 7]",
"total_badness": 1284.6220542 "total_badness": 1364.5936087
}, },
{ {
"ne1d": 370, "ne1d": 370,
"ne2d": 854, "ne2d": 860,
"ne3d": 1130, "ne3d": 1148,
"quality_histogram": "[0, 0, 0, 0, 2, 4, 17, 25, 26, 34, 64, 107, 137, 161, 156, 181, 93, 73, 42, 8]", "quality_histogram": "[0, 0, 0, 0, 2, 4, 16, 24, 25, 32, 78, 104, 135, 154, 165, 176, 112, 66, 43, 12]",
"total_badness": 1739.2621504 "total_badness": 1761.668236
}, },
{ {
"ne1d": 516, "ne1d": 516,
"ne2d": 1584, "ne2d": 1584,
"ne3d": 2549, "ne3d": 2528,
"quality_histogram": "[0, 0, 0, 0, 2, 1, 7, 19, 30, 53, 121, 174, 224, 296, 384, 362, 331, 304, 201, 40]", "quality_histogram": "[0, 0, 0, 0, 2, 1, 9, 16, 23, 49, 125, 186, 212, 309, 339, 362, 346, 314, 191, 44]",
"total_badness": 3600.6650263 "total_badness": 3558.9972665
}, },
{ {
"ne1d": 722, "ne1d": 722,
"ne2d": 2888, "ne2d": 2888,
"ne3d": 6818, "ne3d": 6747,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 3, 12, 29, 67, 167, 379, 655, 877, 1099, 1146, 1177, 948, 258]", "quality_histogram": "[0, 0, 0, 0, 0, 1, 2, 3, 15, 27, 51, 174, 373, 644, 867, 1088, 1146, 1180, 929, 247]",
"total_badness": 8742.2896959 "total_badness": 8655.9198144
}, },
{ {
"ne1d": 1862, "ne1d": 1862,
"ne2d": 19516, "ne2d": 19514,
"ne3d": 135482, "ne3d": 137132,
"quality_histogram": "[0, 0, 0, 0, 0, 1, 0, 6, 30, 145, 444, 1158, 3034, 7025, 13447, 21335, 28448, 30344, 22953, 7112]", "quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 8, 37, 119, 375, 1131, 3044, 6883, 13679, 21959, 28650, 31016, 22896, 7333]",
"total_badness": 165806.81509 "total_badness": 167715.38485
} }
], ],
"lshape3d.geo": [ "lshape3d.geo": [
@ -894,44 +894,44 @@
{ {
"ne1d": 170, "ne1d": 170,
"ne2d": 454, "ne2d": 454,
"ne3d": 1228, "ne3d": 1231,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 5, 5, 20, 38, 51, 111, 128, 195, 211, 190, 152, 90, 31]", "quality_histogram": "[0, 0, 0, 0, 0, 2, 4, 16, 11, 28, 52, 63, 111, 142, 191, 162, 178, 143, 94, 34]",
"total_badness": 1672.6379358 "total_badness": 1732.0556803
}, },
{ {
"ne1d": 112, "ne1d": 112,
"ne2d": 212, "ne2d": 214,
"ne3d": 346, "ne3d": 345,
"quality_histogram": "[0, 0, 0, 3, 8, 8, 8, 9, 19, 25, 40, 40, 35, 39, 38, 37, 17, 14, 5, 1]", "quality_histogram": "[0, 0, 0, 1, 3, 8, 9, 11, 16, 24, 47, 47, 42, 33, 41, 22, 22, 12, 5, 2]",
"total_badness": 629.86936176 "total_badness": 612.66129201
}, },
{ {
"ne1d": 134, "ne1d": 134,
"ne2d": 288, "ne2d": 288,
"ne3d": 523, "ne3d": 502,
"quality_histogram": "[0, 0, 0, 0, 0, 5, 5, 4, 14, 15, 32, 48, 68, 67, 66, 76, 44, 43, 29, 7]", "quality_histogram": "[0, 0, 0, 3, 0, 8, 3, 6, 12, 12, 31, 38, 65, 61, 63, 78, 51, 46, 18, 7]",
"total_badness": 790.86141744 "total_badness": 773.39426016
}, },
{ {
"ne1d": 194, "ne1d": 194,
"ne2d": 594, "ne2d": 596,
"ne3d": 1742, "ne3d": 1742,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 2, 5, 9, 40, 88, 126, 192, 280, 281, 279, 241, 165, 34]", "quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 5, 13, 28, 73, 140, 199, 290, 262, 276, 254, 165, 37]",
"total_badness": 2325.4945287 "total_badness": 2317.9250987
}, },
{ {
"ne1d": 266, "ne1d": 266,
"ne2d": 990, "ne2d": 990,
"ne3d": 4103, "ne3d": 4027,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 1, 2, 13, 28, 69, 162, 317, 534, 761, 831, 732, 513, 140]", "quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 1, 3, 6, 26, 75, 146, 296, 557, 679, 794, 780, 509, 155]",
"total_badness": 5196.8765579 "total_badness": 5077.2355534
}, },
{ {
"ne1d": 674, "ne1d": 674,
"ne2d": 6870, "ne2d": 6870,
"ne3d": 82768, "ne3d": 81834,
"quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 14, 59, 188, 513, 1613, 4088, 7976, 12954, 17553, 18871, 14413, 4526]", "quality_histogram": "[0, 0, 0, 0, 0, 0, 2, 4, 21, 75, 257, 677, 1770, 4204, 8071, 12904, 17072, 18304, 14037, 4436]",
"total_badness": 100797.22838 "total_badness": 100045.3114
} }
], ],
"period.geo": [ "period.geo": [
@ -982,44 +982,44 @@
{ {
"ne1d": 890, "ne1d": 890,
"ne2d": 2646, "ne2d": 2646,
"ne3d": 8528, "ne3d": 8503,
"quality_histogram": "[4, 14, 27, 37, 43, 46, 41, 91, 102, 180, 331, 464, 679, 978, 1233, 1340, 1240, 987, 555, 136]", "quality_histogram": "[4, 9, 28, 39, 37, 47, 43, 74, 102, 194, 278, 421, 644, 952, 1193, 1275, 1330, 1019, 645, 169]",
"total_badness": 12856.87891 "total_badness": 12679.208033
}, },
{ {
"ne1d": 572, "ne1d": 570,
"ne2d": 1228, "ne2d": 1220,
"ne3d": 1901, "ne3d": 1876,
"quality_histogram": "[2, 18, 45, 48, 51, 66, 60, 92, 128, 133, 165, 191, 187, 197, 168, 128, 114, 65, 39, 4]", "quality_histogram": "[4, 18, 43, 52, 44, 59, 75, 90, 120, 136, 177, 191, 179, 176, 167, 129, 108, 64, 28, 16]",
"total_badness": 4320.0075948 "total_badness": 4320.750155
}, },
{ {
"ne1d": 724, "ne1d": 724,
"ne2d": 1754, "ne2d": 1746,
"ne3d": 3285, "ne3d": 3289,
"quality_histogram": "[4, 20, 30, 41, 36, 43, 44, 68, 96, 154, 170, 280, 339, 436, 436, 406, 340, 206, 107, 29]", "quality_histogram": "[4, 21, 25, 37, 42, 45, 44, 74, 117, 151, 194, 292, 340, 395, 460, 353, 330, 228, 114, 23]",
"total_badness": 5959.5331564 "total_badness": 5983.1897176
}, },
{ {
"ne1d": 956, "ne1d": 956,
"ne2d": 2886, "ne2d": 2882,
"ne3d": 8682, "ne3d": 8726,
"quality_histogram": "[3, 11, 23, 48, 51, 47, 53, 55, 92, 133, 207, 340, 555, 905, 1236, 1446, 1418, 1197, 665, 197]", "quality_histogram": "[3, 11, 23, 49, 48, 47, 50, 58, 94, 137, 181, 359, 611, 946, 1233, 1398, 1436, 1193, 656, 193]",
"total_badness": 12703.577343 "total_badness": 12772.914527
}, },
{ {
"ne1d": 1554, "ne1d": 1554,
"ne2d": 6466, "ne2d": 6466,
"ne3d": 31866, "ne3d": 32040,
"quality_histogram": "[4, 7, 10, 5, 21, 54, 53, 79, 111, 204, 328, 684, 1327, 2460, 3983, 5375, 6122, 5827, 4106, 1106]", "quality_histogram": "[5, 6, 7, 7, 25, 52, 53, 68, 107, 199, 330, 692, 1305, 2499, 3880, 5430, 6303, 5976, 3971, 1125]",
"total_badness": 41304.661508 "total_badness": 41506.110521
}, },
{ {
"ne1d": 2992, "ne1d": 2992,
"ne2d": 23396, "ne2d": 23396,
"ne3d": 276949, "ne3d": 276589,
"quality_histogram": "[5, 10, 11, 13, 8, 23, 34, 93, 171, 459, 1121, 2702, 6581, 15040, 28425, 44154, 58179, 60855, 45197, 13868]", "quality_histogram": "[5, 7, 11, 7, 11, 22, 33, 88, 192, 471, 1192, 2796, 6844, 15362, 28665, 44479, 57706, 60282, 44709, 13707]",
"total_badness": 341180.22628 "total_badness": 341214.55024
} }
], ],
"revolution.geo": [ "revolution.geo": [