Comments (6)
d3.polygonHull is returning the list of vertices in the polygon hull; you can find an example here https://observablehq.com/d/afff7b4390bb4e91
from d3-polygon.
Exactly, polygon hull is not returning a polygon. Is there an equivalent of the previous function? actually, i need it just to get the area, d3.geom.polygon(vertices).area()
from d3-polygon.
Did you try d3.polygonArea(d3.polygonHull(vertices))
?
from d3-polygon.
As I have already said, d3.polygonHull is doing something different. In my case, I should be able to calculate the area of "H" shapes, like https://usercontent2.hubstatic.com/6562915.jpg for example.
from d3-polygon.
A polygon is now represented as an array (ordered list) of its vertices. So, if all you need is the area of a polygon, maybe try d3.polygonArea(vertices)
, as there's no need to compute the hull.
My apologies if this still does not answer your question. To ask for help, please use Stack Overflow tag d3.js. Thousands of D3-related questions have been asked there, and some answers may be relevant to you.
When asking for help, please include a link to demonstrate the issue, preferably as an Observable notebook. It is often impossible to debug from code snippets alone. Isolate the issue and reduce your code as much as possible before asking for help. The less code you post, the easier it is for someone to debug, and the more likely you are to get a helpful response.
If you have a question about D3’s behavior and want to discuss it with other users, also consider the d3-js Google Group or joining the d3-js Slack.
Thank you! 🤖
from d3-polygon.
I see, I did not realized that now it is simply an array. Many thanks for your time and suggestion ;)
from d3-polygon.
Related Issues (20)
- geoArea should (?) also work with a list of coordinates HOT 3
- Circle intersection test HOT 1
- Point x and y accessors HOT 1
- More easily import polygon points HOT 1
- Why is Polygon.hull() result not counterclockwise ? HOT 2
- feature requests: polygon union, intersection, difference HOT 1
- broken link HOT 1
- Flipping flag for contain HOT 1
- How should a polygon be filled with a slash? HOT 2
- Merge into d3-geometry package? HOT 1
- Add concaveHull (in addition to convexHull) HOT 4
- segmentIntersect, lineIntersect?
- Rendering? HOT 1
- polygonContains should be uniform when testing the verteces of the polygon HOT 2
- Clipping? HOT 12
- Point-in-polygon test.
- Why do counterclockwise polygons have positive area? HOT 1
- would it make sense to have a "polygon contains polygon" method? HOT 3
- Hull issue (for v3) HOT 1
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 d3-polygon.