@@ -405,13 +405,12 @@ std::vector<Smoothness> Manifold::Impl::SharpenEdges(
405
405
406
406
/* *
407
407
* Sharpen tangents that intersect an edge to sharpen that edge. The weight is
408
- * unchanged, as this has a squared effect on radius of curvature, except
409
- * in the case of zero radius, which is marked with weight = 0.
408
+ * unchanged, as this has a squared effect on radius of curvature.
410
409
*/
411
410
void Manifold::Impl::SharpenTangent (int halfedge, float smoothness) {
412
411
halfedgeTangent_[halfedge] =
413
412
glm::vec4 (smoothness * glm::vec3 (halfedgeTangent_[halfedge]),
414
- smoothness == 0 ? 0 : halfedgeTangent_[halfedge].w );
413
+ halfedgeTangent_[halfedge].w );
415
414
}
416
415
417
416
/* *
@@ -592,45 +591,6 @@ void Manifold::Impl::SetNormals(int normalIdx, float minSharpAngle) {
592
591
}
593
592
}
594
593
595
- /* *
596
- * Tangents get flattened to create sharp edges by setting their weight to zero.
597
- * This is the natural limit of reducing the weight to increase the sharpness
598
- * smoothly. This limit gives a decent shape, but it causes the parameterization
599
- * to be stretched and compresses it near the edges, which is good for resolving
600
- * tight curvature, but bad for property interpolation. This function fixes the
601
- * parameter stretch at the limit for sharp edges, since there is no curvature
602
- * to resolve. Note this also changes the overall shape - making it more evenly
603
- * curved.
604
- */
605
- void Manifold::Impl::LinearizeFlatTangents () {
606
- const int n = halfedgeTangent_.size ();
607
- for_each_n (
608
- autoPolicy (n), zip (halfedgeTangent_.begin (), countAt (0 )), n,
609
- [this ](thrust::tuple<glm::vec4&, int > inOut) {
610
- glm::vec4& tangent = thrust::get<0 >(inOut);
611
- const int halfedge = thrust::get<1 >(inOut);
612
- glm::vec4& otherTangent =
613
- halfedgeTangent_[halfedge_[halfedge].pairedHalfedge ];
614
-
615
- const glm::bvec2 flat (tangent.w == 0 , otherTangent.w == 0 );
616
- if (!halfedge_[halfedge].IsForward () || (!flat[0 ] && !flat[1 ])) {
617
- return ;
618
- }
619
-
620
- const glm::vec3 edgeVec = vertPos_[halfedge_[halfedge].endVert ] -
621
- vertPos_[halfedge_[halfedge].startVert ];
622
-
623
- if (flat[0 ] && flat[1 ]) {
624
- tangent = glm::vec4 (edgeVec / 3 .0f , 1 );
625
- otherTangent = glm::vec4 (-edgeVec / 3 .0f , 1 );
626
- } else if (flat[0 ]) {
627
- tangent = glm::vec4 ((edgeVec + glm::vec3 (otherTangent)) / 2 .0f , 1 );
628
- } else {
629
- otherTangent = glm::vec4 ((-edgeVec + glm::vec3 (tangent)) / 2 .0f , 1 );
630
- }
631
- });
632
- }
633
-
634
594
/* *
635
595
* Redistribute the tangents around each vertex so that the angles between them
636
596
* have the same ratios as the angles of the triangles between the corresponding
@@ -916,7 +876,6 @@ void Manifold::Impl::CreateTangents(std::vector<Smoothness> sharpenedEdges) {
916
876
});
917
877
}
918
878
}
919
- LinearizeFlatTangents ();
920
879
}
921
880
922
881
void Manifold::Impl::Refine (std::function<int (glm::vec3)> edgeDivisions) {
0 commit comments