Comments (8)
I like this. Any reason why you are using functions, not methods on Seed
?
from noise-rs.
Because it hadn't occurred to me. :-)
My first draft didn't include Seed. Then I realized I needed a seed structure, so added it to all the functions. So I didn't think of turning them into member functions.
That said, I think making them into member functions would make them less composable. If I want to call brownian2d on perlin noise now, this is how I'd do it:
let noise = brownian2d(seed, point, perlin2d, 16, 3);
But if we made these member functions of Seed, it would have to be:
let noise = seed.brownian2d(point, |seed: Seed, point: (f32, f32)| seed.perlin2d(point), 16, 3);
So I think I'd argue to keep them as free functions. That said, Seed should really be passed by borrow. I'll go through and fix that.
Also, I left of lacunarity and persistence in the brownian motion, even though your current implementation includes them. They should probably be added back in. However, I also feel they should have defaults of 2.0 and 0.5, as that's what you want like 99% of the time.
from noise-rs.
Oh, apparently I can't edit the issue once it's been responded to. Oh well. The proposed changes are still captured in my comment.
Also thinking about a way to better generalize the worley noise into two parts. One generates a set of nearby cell points, and the other analyzes those points to produce a value. Sort of like what's already in this proposal, except with the ability to swap out for a different point generation algorithm.
I don't think I'd include any other point generation algorithms in the noise-rs library, for now... But I could see consumers of this library wanting to implement some alternate algorithms.
from noise-rs.
Regarding the composability concerns, note that UFCS you could do:
seed.brownian2d((x, y), Seed::perlin2d, ..)
Have you seen http://libnoise.sourceforge.net/ by the way? Here are some Haskell libraries based on it:
Might be abit complex though, I like the simplicity of your approach.
from noise-rs.
I had not seen this... I'll dig into it's structure a bit, and see if there's anything that seems worth pulling out.
from noise-rs.
@Cifram do you feel a need to expand on this any further?
from noise-rs.
No, not really... This post was made before I started contributing to this library. This API was pretty much implemented, and refined, before my attention turned elsewhere. I haven't been actively involved in any development here for close to 2 years.
from noise-rs.
Thanks for the followup.
from noise-rs.
Related Issues (20)
- Update MSRV to 1.59 due to Rayon update
- Worley noise distance output unexpected. HOT 1
- the method get() of perlin's noise will always be 0 when x, y >=1 HOT 6
- [BUG] Simplex Noise generates Artifacts HOT 2
- [BUG] Worley Noise generates similar pattern regardless the seed
- [BUG] More Perlin Noise Panics
- Fbm returns value outside of [-1, 1] HOT 2
- [BUG] RidgedMulti not seeding sources properly HOT 2
- Unexpected smooth noise in unreleased version HOT 1
- Possibility of a Release HOT 2
- Include example images in the docs
- Perlin noise always returns 0 on whole numbers HOT 2
- Remove exponentation from fractal generators
- Open Simplex unwrap
- AxialGradient type would be helpful
- Possible typo in Turbulence docs? HOT 1
- `noise::NoiseFn` doesn't implement `Debug`
- Exact value to get() always return 0 HOT 2
- Example on main README throws error
- What do x and y bounds do?
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 noise-rs.