computing the base triangle height of a pattern as the half of the bbox of the fanned configuration. Previous version used the triangleEdgeSize variable which must had been set and made things more complicated

This commit is contained in:
iasonmanolas 2022-01-19 12:32:55 +02:00
parent 27c1822c2a
commit fbd85d4d77
1 changed files with 7 additions and 3 deletions

View File

@ -99,11 +99,15 @@ PatternGeometry PatternGeometry::createTile(PatternGeometry &pattern)
vcg::tri::UpdatePosition<PatternGeometry>::Matrix(fan, R);
}
vcg::Matrix44d T;
const double centerAngle = 2 * M_PI / fanSize;
const double triangleHeight = std::sin((M_PI - centerAngle) / 2)
* PatternGeometry().triangleEdgeSize;
// const double centerAngle = 2 * M_PI / fanSize;
// const double triangleHeight = std::sin((M_PI - centerAngle) / 2)
// * PatternGeometry().triangleEdgeSize;
vcg::tri::UpdateBounding<PatternGeometry>::Box(fan);
const double triangleHeight = fan.bbox.DimY() / 2;
T.SetTranslate(0, -2 * triangleHeight, 0);
vcg::tri::UpdatePosition<PatternGeometry>::Matrix(fan, T);
// fan.registerForDrawing();
// polyscope::show();
PatternGeometry fanOfFan = createFan(fan);
vcg::tri::Append<PatternGeometry, PatternGeometry>::Mesh(tile, fanOfFan);