Comments (6)
Note to myself:
function main() { return hull( CAG.circle({radius:2}).translate([-1,0]), CAG.circle().translate([1,0]), CAG.circle().translate([0,1.01]) ); }
works.
Problem: in this.ccw and stack calculation (x1==x2 or y1==y2)
from openjscad.org.
More simple case:
function main() { return hull( CAG.circle().translate([0,1]), CAG.circle().translate([0,-1]) ); }
gives error, the two circles have a common point, the moment they are apart hull() works.
from openjscad.org.
Perhaps recode the sort to use the faster isLeft() function described for the Graham scan algorithm:
http://geomalgorithms.com/a01-_area.html#isLeft()
via http://geomalgorithms.com/a10-_hull-1.html
Avoids the need for atan... looks partially implemented with the ccw function?
from openjscad.org.
isLeft() = ccw(), the problem lies in the stack operation while(this.ccw(...)<=0) ... and I already have tested prefiltering multiple points with same coords (not sure if it works as I still run the same problem). I did some more testing, it seems with most close (1e-5 or less) but not quite identical x1==x1 and y1==y2
from openjscad.org.
this quick hack to the ccw function sorts it:
this.ccw = function(p1, p2, p3) {
var tmp = (this.points[p2].x - this.points[p1].x)*(this.points[p3].y - this.points[p1].y) -
(this.points[p2].y - this.points[p1].y)*(this.points[p3].x - this.points[p1].x);
// look for close points
if (tmp < 0.000001) tmp = 0;
return tmp;
}
from openjscad.org.
great, yes, it does it (thanks!)
from openjscad.org.
Related Issues (20)
- Balloons appear to be regenerating after toggling dropdown menu on jscad.app HOT 1
- V3 : test IO translations
- Union of 2D polygon and its mirrorX doesn't work HOT 1
- V3: parameter definitions
- subtracting extrudeHelical object (like threads) from a cube does not work as expected HOT 4
- Geometry is not closed error
- Vertices get merged unexpectedly HOT 5
- Select in parameters does not match other inputs style HOT 2
- JSCAD GUI does not cleanup messages for repeated SHIFT+ENTER on same script
- Feature request: openjscad.xyz/?uri= support for "data" scheme in addition to "http(s)" HOT 7
- Feature request: custom mouse controls HOT 1
- Typo in example
- plane.fromPoints() implementation buggy HOT 5
- V2 backwards compatibility with V1 HOT 15
- @jscad/stl-deserializer in the browser? HOT 7
- stl-deserializer having issues with some STLs HOT 4
- https issue and/or openjscad.xyz domain expired? HOT 9
- Keyboard Shortcuts Some Not Working HOT 1
- jscad cli does not work via clean install on fresh linux machine HOT 1
- 3D quickhull() does not always work correctly when all vertices are in same plane HOT 9
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 openjscad.org.