Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Feature request: More functions as parameters #38

Open
brad opened this Issue · 5 comments

2 participants

@brad

I love the ability of ImplicitCAD to use a function for the twist parameter of linear_extrude and I think it would be amazing is this were available in more places.
Some good examples would be the radius of circles and spheres. Maybe even the radius of a cylinder, which could vary with the height as well as the arc angle.

I was hoping to produce a wavy circle with this:

Prelude Graphics.Implicit> writeSVG 1 "test.svg" (let r x = sin(x) in circle(r))

<interactive>:1:51:
    Couldn't match expected type `Float' with actual type `a0 -> a0'
    Expected type: Graphics.Implicit.Definitions.â


    In the first argument of `circle', namely `(r)'
    In the expression: circle (r)
@colah colah was assigned
@colah
Owner

Hey Brad,

I agree that it would be really cool to have more function parameters. The types that would develop if we made everything polymorphic in Haskell might be a bit tedious, but we could certainly have circleVariableRadius :: (ℝ -> ℝ) -> Obj2 or something... I was actually thinking of something similar with an eye to making gears.

So this is coming!

By the way, the shape would have been a Rose with k=1, had it been implemented. Roses are pretty :)

@brad

Yeah, I guess it makes sense to use the different function for that. Good call on the Rose function, my mistake, I guess the function I wanted was more like "r x = 20 + sin(x)"?

@colah
Owner

That's just going to shift it. You want a higher frequency. Something like r x = 20 + sin(5*x) is likely closer to what you want.

@brad

Ahh, schooled again. Thank you :)

@colah
Owner

A comment: linear_extrude now supports scale and translate options on the extopenscad end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.