Comments (5)
from jsketcher.
Also current algorithm isn't very robust and fails in some corner cases.
from jsketcher.
After think twice about the whole things.I think it's a timing to start a new project which include brep, csg algorithms and triangulation algorithms. And take advantage of algorithms supported by verb-nurbs which include tessellate and intersection algorithm of nurbs surface.
I have to learn more about nurbs-surface/curve before doing this.
By the way, triangulation of plane face with nurbs-curve in outer loop can easily improved by add the code below in '.../3d/triangulation.js'
export function TriangulateFace(face) {
function arr(v) {
return [v.x, v.y, v.z];
}
function vertexCallback(data, out) {
out.push(data);
}
function combinecallback(coords, data, weight) {
//throw 'should never happen cuz brep is non-manifold'
}
function edgeCallback(flag) {
}
var tessy = new libtess.GluTesselator();
// tessy.gluTessProperty(libtess.gluEnum.GLU_TESS_WINDING_RULE, libtess.windingRule.GLU_TESS_WINDING_POSITIVE);
tessy.gluTessCallback(libtess.gluEnum.GLU_TESS_VERTEX_DATA, vertexCallback);
tessy.gluTessCallback(libtess.gluEnum.GLU_TESS_BEGIN, begincallback);
tessy.gluTessCallback(libtess.gluEnum.GLU_TESS_ERROR, errorcallback);
tessy.gluTessCallback(libtess.gluEnum.GLU_TESS_COMBINE, combinecallback);
tessy.gluTessCallback(libtess.gluEnum.GLU_TESS_EDGE_FLAG, edgeCallback);
const normal = arr(face.surface.normal);
tessy.gluTessNormal(normal[0], normal[1], normal[2]);
const vertices = [];
tessy.gluTessBeginPolygon(vertices);
for (let loop of face.loops) {
tessy.gluTessBeginContour();
for (let e of loop.halfEdges) {
+++ if(e.edge.curve.isLine)
tessy.gluTessVertex(arr(e.vertexA.point), e.vertexA);
+++ else if(e.edge.curve.isNurbsCurve){
+++ tessy.gluTessVertex(arr(e.vertexA.point), e.vertexA);
+++ let nurbsVectors = e.edge.curve.verb.tessellate()
+++ nurbsVectors.shift()
+++ nurbsVectors.forEach(v => {
+++ let midVertex = new Vertex(v[0], v[1], v[2])
+++ tessy.gluTessVertex(v, midVertex)}
+++ )
}
}
tessy.gluTessEndContour();
}
....
from jsketcher.
@xibyte Thanks for your explain on gluTessNormal. The code before is just for a plane face with nurbs-curve in its ourerLoop. I know it do not works for nurbs -surface. In fact, I found tessellate algorithm was originally supported in verbnurbs by @pboyer .So I think if we can adjust the structure of our code and make use of the algorithm in verbnurb directly ? May be we can even adjust the code in the verbnurbs?
from jsketcher.
done in 8204748
from jsketcher.
Related Issues (20)
- Don't highlight a face just because it is moused over
- UI: could you add a view cube? HOT 1
- UI: Could you brighten up the colors?
- UI: Configurability? HOT 1
- is all source code open source HOT 2
- The exported dxf not opening in AutoCAD HOT 3
- Export as FCStd HOT 11
- Cannot enlarge memory HOT 3
- Is the the open source part of the license more like GPL or LGPL? HOT 2
- critical vulnerabilities HOT 1
- "npm run build" fails to include wasm and font awesome. HOT 2
- [bug]: 2D sketcher interfacing to 3d environments fails on attached sketch HOT 1
- Chrome and Safari performance is much worse than Firefox in 2D sketcher HOT 3
- Jsketcher sketch geometry doesn't visualize after finishing sketch HOT 4
- performing operation with current parameters leads to an invalid object (self-intersecting / zero-thickness / complete degeneration or unsupported cases) HOT 2
- Unable to import large STEP file
- [bug] Point on circle failing to put point on arc segment.
- How do I extrude with a hole? HOT 1
- How do I add textures to the model
- Determine the type of the mirrored product
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsketcher.