File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/main/java/mesh/modifier Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -26,18 +26,26 @@ private void simpleDeformBend(Vector3f v) {
2626 float sinTheta = Mathf .sin (theta );
2727 float cosTheta = Mathf .cos (theta );
2828
29- if (Mathf .abs (factor ) > EPSILON ) {
30- float bx = -(v .y - 1.0f / factor ) * sinTheta ;
31- float by = (v .y - 1.0f / factor ) * cosTheta + 1.0f / factor ;
32- float bz = v .z ;
33- v .set (bx , by , bz );
34- }
29+ float bx = -(v .y - 1.0f / factor ) * sinTheta ;
30+ float by = (v .y - 1.0f / factor ) * cosTheta + 1.0f / factor ;
31+ float bz = v .z ;
32+
33+ v .set (bx , by , bz );
34+ }
35+
36+ private void bend (Mesh3D mesh ) {
37+ for (Vector3f v : mesh .vertices )
38+ simpleDeformBend (v );
39+ }
40+
41+ private boolean isFactorValid () {
42+ return Mathf .abs (factor ) > EPSILON ;
3543 }
3644
3745 @ Override
3846 public Mesh3D modify (Mesh3D mesh ) {
39- for ( Vector3f v : mesh . vertices )
40- simpleDeformBend ( v );
47+ if ( isFactorValid () )
48+ bend ( mesh );
4149 return mesh ;
4250 }
4351
You can’t perform that action at this time.
0 commit comments