-
Notifications
You must be signed in to change notification settings - Fork 3
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
An attempt to subdivide each edge in 3 #11
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,10 @@ function subdivideHyperbolicArc( arc, numDivisions ) { | |
// calculate the number of subdivisions required to break the arc into an | ||
// even number of pieces (or 1 in case of tiny polygons) | ||
|
||
numDivisions = numDivisions || ( arc.arcLength > 0.001 ) | ||
? 2 * Math.ceil( arc.arcLength ) // currently always = 2 | ||
: 1; | ||
// numDivisions = numDivisions || ( arc.arcLength > 0.001 ) | ||
// ? 2 * Math.ceil( arc.arcLength ) // currently always = 2 | ||
// : 1; | ||
numDivisions = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Force all edges to be subdivided in 3 |
||
|
||
// calculate spacing based on number of points | ||
const spacing = arc.arcLength / numDivisions; | ||
|
@@ -129,7 +130,7 @@ function subdivideHyperbolicPolygon( polygon ) { | |
const startPoint = subdividedEdges[2][( numDivisions - i )]; | ||
const endPoint = subdividedEdges[1][i]; | ||
// this.subdivideInteriorArc( startPoint, endPoint, i ); | ||
const newPoints = subdivideLine( startPoint, endPoint, i ); | ||
const newPoints = subdivideLine( startPoint, endPoint, numDivisions, i ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo here? Was not matching the prototype of |
||
|
||
// for ( let j = 0; j < newPoints.length; j++) { | ||
// flatPoints.push( | ||
|
@@ -256,30 +257,13 @@ export default function createGeometries( tiling ) { | |
edgeStartingVertex += m; | ||
} | ||
|
||
return [ positionIndex, uvIndex ]; | ||
} | ||
|
||
if ( polygon.materialIndex === 0 ) { | ||
addPositionsAndUvs( positionsA, positionAIndex, uvsA, uvAIndex ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleanup, so that "Too many divisions!!" error is not thrown |
||
if ( divisions === 1 ) { | ||
positionAIndex += 9; | ||
uvAIndex += 6; | ||
} else if ( divisions === 2 ) { | ||
positionAIndex += 36; | ||
uvAIndex += 24; | ||
} else { | ||
console.error( 'Too many divisions!!' ); | ||
} | ||
[ positionAIndex, uvAIndex ] = addPositionsAndUvs( positionsA, positionAIndex, uvsA, uvAIndex ); | ||
} else { | ||
addPositionsAndUvs( positionsB, positionBIndex, uvsB, uvBIndex ); | ||
if ( divisions === 1 ) { | ||
positionBIndex += 9; | ||
uvBIndex += 6; | ||
} else if ( divisions === 2 ) { | ||
positionBIndex += 36; | ||
uvBIndex += 24; | ||
} else { | ||
console.error( 'Too many divisions!!' ); | ||
} | ||
[ positionBIndex, uvBIndex ] = addPositionsAndUvs( positionsB, positionBIndex, uvsB, uvBIndex ); | ||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable
designMode