Comments (13)
It probably also depends on what you intend to do: are you trying to find individual points on the surface, are you trying to approximate the surface as a mesh for rendering purposes, etc.
from bezierjs.
In fact I need to calculate the value itself for printing purposes, then I can infer material usage, costs etc.
from bezierjs.
But what is "the value"? A surface has infinitely many values, so what are you actually trying to find?
from bezierjs.
It is the fill of the PolyBezier.
from bezierjs.
Currently I am using pixel counting
from bezierjs.
Are you implementing your own graphics (sub)system? Because most programming languages already come with shape fill solutions =)
from bezierjs.
no, I am not.
Because most programming languages already come with shape fill solutions =)
Please elaborate. I am using plain web vanilla js.
from bezierjs.
The web stack has SVG: creating a <path d="...." stroke="none" fill="red"/>
generally does the job for you. And Canvas2D will happily draw an SVG image wherever you need it using the .image
function, too, if you're working in bitmap context rather than DOM context.
But of course the best solution will require knowing more about what you're actually working on and how you're implementing that atm.
from bezierjs.
I am building an app that prints letters using CNC
The requirements are to know the surface of each letter (=fill of letter) and the outline. The machine will cut according to the outline and the cost is derived by the surface, the amount of material used.
PolyBezier has made it easy to figure out the outline. Pixel counting is an easy workaround to obtain the fill value. I thought it might need a pure math solution... so I posted this issue.
Regardless I think it is useful to be able to calculate the value using pure math if it isn't too complicated.
Thanks for the help so far!
from bezierjs.
I think we're running into term confusion here: you're not talking about surfaces in relation to Bezier curves, which are a property of 3D curve sets. You're talking about actual physical material surfaces, so: be aware of the fact that the same term in different context can mean a wildly different thing. Don't talk about "bezier surfaces" when you're not talking about 3D surface math, you're just going to confuse math folks =)
So: you looking for a way to efficiently run a CnC bit along a path that will clear the interior of a closed shape. You absolutely don't want to use pixel counting for that, you want to know the dimensions of the CnC bit so that you can trace a path for that bit with minimal overlap. For that, you can just inset the polybezier: if your bit is Xmm, and you want a 10% cut overlap, and you have an initial outline, your first pass will be "that outline, offset by Xmm on the inside", and that's the first cutting pass. Then every subsequent pass is another (X*0.9mm) internal offset.
(i.e. take advantage of the fact that you have parallel contours)
from bezierjs.
take advantage of the fact that you have parallel contours
This is correct most of the time and means that to calculate the fill amount w/o pixel counting I need to split all the contours into segments by the x axis for integral calculation. Can be done but I hoped to avoid it with some clever math.
Thanks for your response and great work
from bezierjs.
If I do that would you be interested in a contribution exposing a method on PolyBezier? If so please provide a name for it ;)
from bezierjs.
it depends a little on what it does, specifically, but something like sweep
might make sense.
from bezierjs.
Related Issues (20)
- Release v6.1.2 broken HOT 3
- Why get(t = 0.5) point is not the middle point of the curve? HOT 5
- Find optmal D1 - Bezier.cubicFromPoints HOT 1
- PolyBezier is not exported correct for ES Module. HOT 3
- Rational Bezier Curve Support HOT 1
- Example usage of `dist/bezier.js` HOT 4
- How to make a "strict" version of bezier.project(point)? HOT 2
- Should bezier.lineIntersects(line) work for line-line intersections? HOT 3
- intersects bug Bezier to Bezier HOT 3
- Suspicious line in `utils.compute()` HOT 2
- The intersection of the two bezier is empty HOT 10
- The intersection of two identical curves HOT 2
- Intersect line method does not always return existing intersections HOT 6
- Ability to get and estimate the centerline of a list of 3D points HOT 3
- PR for extending API to interpolate values along curve and find point on curve at distance?
- Artifact when offsetting an SVG path
- Split curves do not follow old curve. HOT 2
- Missing LICENSE file HOT 1
- How to Find Y-Coordinate for a Given X-Coordinate on a Bezier Curve HOT 3
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 bezierjs.