diff options
author | Martin Poirier <theeth@yahoo.com> | 2007-11-08 00:45:35 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2007-11-08 00:45:35 +0300 |
commit | e7c4bad8e929fd690aed9c652157eb3c8688c850 (patch) | |
tree | 6027a9d1e85e9645107f246bedf8663f6c5e6117 /source/blender/src/reeb.c | |
parent | 4cae0a0ff9110fd4bf1e284b7c49ac435dfbe1ea (diff) |
Update from school work.
Diffstat (limited to 'source/blender/src/reeb.c')
-rw-r--r-- | source/blender/src/reeb.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/src/reeb.c b/source/blender/src/reeb.c index d5338786d50..efe12a5db21 100644 --- a/source/blender/src/reeb.c +++ b/source/blender/src/reeb.c @@ -380,6 +380,25 @@ void buildAdjacencyList(ReebGraph *rg) addArcToNodeAdjacencyList(arc->v2, arc); } } +/****************************************** SMOOTHING **************************************************/ + +void smoothGraph(ReebGraph *rg) +{ + ReebArc *arc; + + for(arc = rg->arcs.first; arc; arc = arc->next) + { + EmbedBucket *buckets = arc->buckets; + int bcount = arc->bcount; + int index; + + for(index = 1; index < bcount - 1; index++) + { + VecLerpf(buckets[index].p, buckets[index].p, buckets[index - 1].p, 0.5f); + VecLerpf(buckets[index].p, buckets[index].p, buckets[index + 1].p, 1.0f/3.0f); + } + } +} /****************************************** FILTERING **************************************************/ @@ -1787,6 +1806,11 @@ void generateSkeleton(void) verifyBuckets(rg); + if (G.scene->toolsettings->skgen_options & SKGEN_SMOOTH) + { + smoothGraph(rg); + } + buildAdjacencyList(rg); exportGraph(rg, -1); |