Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward differencing in curve, surface tessellation #35

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f82f6dc
Use mutating vector methods throughout Eval, provide new regular samp…
pboyer Oct 25, 2015
eaf3994
Proper forward differencing implementation for curves
pboyer Oct 28, 2015
74226a5
Using arrow syntax in tests, further work on rationalCurveSampleRegul…
pboyer Oct 28, 2015
c963306
Fixed bugs with rationalCurveRegularSamplePoints
pboyer Oct 28, 2015
14216c3
Some cleanup
pboyer Oct 29, 2015
11877af
Some minor perf improvements
pboyer Oct 29, 2015
5496383
Stub out new regular surface sampling algo
pboyer Oct 29, 2015
e41d301
Use spaces in code, rather than tabs
pboyer Nov 10, 2015
ddd1674
more code reformatting
pboyer Nov 10, 2015
ca71c21
More code clean up
pboyer Nov 10, 2015
8421780
Almost done with tolerant sampling
pboyer Nov 11, 2015
8015336
Fix tests for new adaptive sampling code
pboyer Nov 11, 2015
ec418fa
Some cleanup
pboyer Nov 11, 2015
c56474c
rationalBezierSurfaceStepLength
pboyer Nov 12, 2015
7722fdf
Improved surface knot refinement
pboyer Nov 13, 2015
c12e15c
Fixed issue with surfaceKnotRefine2
pboyer Nov 13, 2015
72f06e5
Fix issues with improved surface knot refinement methods
pboyer Nov 17, 2015
e8e19f9
Delete old surface refinement code
pboyer Nov 17, 2015
c8eeb39
Complete algorithm for fast tessellation by forward differencing
pboyer Nov 23, 2015
bc6ff90
More speeed
pboyer Feb 7, 2016
da77d39
Ensure handling of flat faces in forward differencing tessellation
pboyer Feb 8, 2016
d111c76
Fix bug in stitching code
pboyer Feb 15, 2016
278547d
Build UVs when tessellating
pboyer Feb 16, 2016
33b97b0
some more progress
pboyer Aug 19, 2016
79e3f21
Update todo
pboyer Jan 16, 2017
1a16494
merge w master
pboyer Jan 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ module.exports = function(grunt) {
reporter: 'spec',
quiet: false // Optionally suppress output to standard out (defaults to false)
},
src: ['test/testCore.js', 'test/testEval.js', 'test/testGeom.js']
//src: ['test/testCore.js', 'test/testEval.js', 'test/testGeom.js']
src: ['test/testEval.js']
}
},

Expand Down
22 changes: 22 additions & 0 deletions benchmark/regularCurveSampling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var Benchmark = require('benchmark')
, verb = require('../build/js/verb.js');

var crv = verb.eval.Make.rationalBezierCurve( [[0,0,0], [1,1,1], [2,1,1], [3,1,0]] );

module.exports = {
name: 'Regular curve sampling',
tests: {
'rationalCurveRegularSample (6560)': function() {
var p = verb.eval.Tess.rationalCurveRegularSample( crv, 6560 );
},
'direct evaluation (6560)': function() {
var p = [];
var sp = 1 / 6560;

for (var i = 0; i < 6561; i++){
p.push( verb.eval.Eval.rationalCurvePoint( crv, i*sp ) )
}
}
}
};

56 changes: 56 additions & 0 deletions benchmark/regularSurfaceDerivatives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
var Benchmark = require('benchmark')
, verb = require('../build/js/verb.js');

function getComplexSurface(){

var degree = 3
, knots = [0, 0, 0, 0, 0.333, 0.666, 1, 1, 1, 1]
, pts = [ [ [0, 0, -10], [10, 0, 0], [20, 0, 0], [30, 0, 0] , [40, 0, 0], [50, 0, 0] ],
[ [0, -10, 0], [10, -10, 10], [20, -10, 10], [30, -10, 0] , [40, -10, 0], [50, -10, 0] ],
[ [0, -20, 0], [10, -20, 10], [20, -20, 10], [30, -20, 0] , [40, -20, -2], [50, -20, 0] ],
[ [0, -30, 0], [10, -30, 0], [20, -30, -23], [30, -30, 0] , [40, -30, 0], [50, -30, 0] ],
[ [0, -40, 0], [10, -40, 0], [20, -40, 0], [30, -40, 4] , [40, -40, -20], [50, -40, 0] ],
[ [0, -50, 12], [10, -50, 0], [20, -50, 0], [30, -50, 0] , [50, -50, 0], [50, -50, -15] ], ]
, wts = [ [ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1] ];

pts = verb.eval.Eval.homogenize2d(pts, wts);

var srfObj = {
degreeU : degree,
degreeV : degree,
knotsU : knots,
knotsV : knots,
controlPoints : pts
};

return srfObj;
}

var complexSurface = getComplexSurface();

module.exports = {
name: 'Regular surface derivatives',
tests: {
'rationalSurfaceRegularSampleDerivatives (80 x 80)': function() {
var ar = verb.eval.Eval.rationalSurfaceRegularSampleDerivatives( complexSurface, 80, 80, 1 );
},
'direct evaluation (80 x 80)': function() {
var ar = [];
var sp = 1 / 80;

for (var i = 0; i < 81; i++){
var ari = [];
ar.push(ari);
for (var j = 0; j < 81; j++){
ari.push( verb.eval.Eval.rationalSurfaceDerivatives( complexSurface, i*sp, j*sp, 1 ) )
}
}
}
}
};

59 changes: 59 additions & 0 deletions benchmark/regularSurfaceSampling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
var Benchmark = require('benchmark')
, verb = require('../build/js/verb.js');

function getComplexSurface(){

var degree = 3
, knots = [0, 0, 0, 0, 0.333, 0.666, 1, 1, 1, 1]
, pts = [ [ [0, 0, -10], [10, 0, 0], [20, 0, 0], [30, 0, 0] , [40, 0, 0], [50, 0, 0] ],
[ [0, -10, 0], [10, -10, 10], [20, -10, 10], [30, -10, 0] , [40, -10, 0], [50, -10, 0] ],
[ [0, -20, 0], [10, -20, 10], [20, -20, 10], [30, -20, 0] , [40, -20, -2], [50, -20, 0] ],
[ [0, -30, 0], [10, -30, 0], [20, -30, -23], [30, -30, 0] , [40, -30, 0], [50, -30, 0] ],
[ [0, -40, 0], [10, -40, 0], [20, -40, 0], [30, -40, 4] , [40, -40, -20], [50, -40, 0] ],
[ [0, -50, 12], [10, -50, 0], [20, -50, 0], [30, -50, 0] , [50, -50, 0], [50, -50, -15] ], ]
, wts = [ [ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1] ];

pts = verb.eval.Eval.homogenize2d(pts, wts);

var srfObj = {
degreeU : degree,
degreeV : degree,
knotsU : knots,
knotsV : knots,
controlPoints : pts
};

return srfObj;
}

var complexSurface = getComplexSurface();

module.exports = {
name: 'Regular surface sampling',
tests: {
'surfaceRegularSample2 (80 x 80)': function() {
verb.eval.Tess.surfaceRegularSample2( complexSurface, 80, 80 );
},
'surfaceRegularSample (80 x 80)': function() {
verb.eval.Tess.surfaceRegularSample( complexSurface, 80, 80 );
},
'direct evaluation (80 x 80)': function() {
var ar = [];
var sp = 1 / 80;

for (var i = 0; i < 81; i++){
var ari = [];
ar.push(ari);
for (var j = 0; j < 81; j++){
ari.push( verb.eval.Eval.surfacePoint( complexSurface, i*sp, j*sp ) )
}
}
}
}
};

48 changes: 48 additions & 0 deletions benchmark/surfaceTessellation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
var Benchmark = require('benchmark')
, verb = require('../build/js/verb.js')
, verbOld = require('../build/js/verbOld.js');

function getComplexSurface(){

var degree = 3
, knots = [0, 0, 0, 0, 0.333, 0.666, 1, 1, 1, 1]
, pts = [ [ [0, 0, -10], [10, 0, 0], [20, 0, 0], [30, 0, 0] , [40, 0, 0], [50, 0, 0] ],
[ [0, -10, 0], [10, -10, 10], [20, -10, 10], [30, -10, 0] , [40, -10, 0], [50, -10, 0] ],
[ [0, -20, 0], [10, -20, 10], [20, -20, 10], [30, -20, 0] , [40, -20, -2], [50, -20, 0] ],
[ [0, -30, 0], [10, -30, 0], [20, -30, -23], [30, -30, 0] , [40, -30, 0], [50, -30, 0] ],
[ [0, -40, 0], [10, -40, 0], [20, -40, 0], [30, -40, 4] , [40, -40, -20], [50, -40, 0] ],
[ [0, -50, 12], [10, -50, 0], [20, -50, 0], [30, -50, 0] , [50, -50, 0], [50, -50, -15] ], ]
, wts = [ [ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1],
[ 1, 1, 1, 1, 1, 1] ];

pts = verb.eval.Eval.homogenize2d(pts, wts);

var srfObj = {
degreeU : degree,
degreeV : degree,
knotsU : knots,
knotsV : knots,
controlPoints : pts
};

return srfObj;
}

var surface = getComplexSurface();

module.exports = {
name: 'rationalSurfaceAdaptiveSample',
tests: {
'rationalSurfaceAdaptiveSample (tol 0.2)': function() {
var mesh = verb.eval.Tess.rationalSurfaceAdaptiveSample( surface, 0.1 );
},
'rationalSurfaceAdaptive (default)': function() {
var mesh = verb.eval.Tess.rationalSurfaceAdaptive( surface );
}
}
};

60 changes: 0 additions & 60 deletions benchmark/tessellate.js

This file was deleted.

Loading