NixOS / nixos-artwork

Nix related artwork
311 stars 77 forks source link

Replace inkscape ported OpenSCAD flake with parametric model. #100

Closed djacu closed 8 months ago

djacu commented 1 year ago

This is a NixOS flake logo that is fully parametric. The size, height, thickness and gap are variable. Thanks to @waalge for helping with the maths.

The parameters for generating a NixOS flake.

gap - The gap between lambdas. height - The z-height of the flake. scale - The radial (x,y) size of the flake. thickness - The thickness of the lambda legs.

scale updates gap and thickness so there is no need to compesate these values. A gap of 0 will leave no gap between the lambdas. A gap of 1 will remove the top portion of the long lambda leg until the point where the two lambda legs intersect.

A gap of 0.05 to 0.15 is a good value for replicating the official NixOS flake. A thickness of 0.5 is a good value for replicating the official NixOS flake. OpenSCAD doesn't have a concept of units so use scale and height values in the desired ratio.

My defaults with a thickness of 0.5 and gap of 0.1. simple-flake simple-flake-top thickness decreased to 0.25. simple-flake-thickness-0 25 thickness increased to 0.75. simple-flake-thickness-0 75 gap reduced to 0. simple-flake-no-gap gap increased to 0.2. simple-flake-gap-0 2

ners commented 1 year ago

I wonder how this PR relates to https://github.com/NixOS/nixos-artwork/pull/84. Does one supersede the other?

MatthewCroughan commented 1 year ago

@ners I think the SCAD code in this, is a bit simpler, in some ways it's a bit of a refactor of #84, I think this PR would take precedent, given the fact that it's less code that does the same thing.

djacu commented 1 year ago

@ners In addition to what @MatthewCroughan said, this PR does not rely on intersecting geometries like #84 does. I read through #84 and it creates lambdas by performing boolean operations on several squares which is not ideal. For this PR I figured out explicitly where each vertex of the lambda exists, so each lambda is a single fully constructed polygon.

djacu commented 1 year ago

If you look at the image below, you can see how I determine the points. What I discovered was that if you image a line running through the center of the lambda legs, they should intersect 3 points of a hexagon: the upper left and the two bottom vertices. That makes it easy to draw the outer parts of the lambda which are just thickness at some angle 60*n where n is an integer. The points of the lambda close to the origin where tricker to figure out but you can see everything on lines 57-65 of the parametric-flake.scad file.

image

djacu commented 11 months ago

cc @samueldr

cab404 commented 10 months ago

well, the gradient problem is still there

(also, intersections allow for wider range of modification, but since it's a nixos artwork repo, I guess that's not that good of an argument)

anyways, good job with simplifying it to a polygon! <3

djacu commented 8 months ago

well, the gradient problem is still there

(also, intersections allow for wider range of modification, but since it's a nixos artwork repo, I guess that's not that good of an argument)

anyways, good job with simplifying it to a polygon! <3

Thanks!

Yeah the gradient problem still exists, but I don't have the scad skills to figure it out nor the time right now.

cab404 commented 8 months ago

Having #84 hanging here for a while just due to gradients not being there, and then this getting merged is a bit... well, actually quite a bit — insulting.

djacu commented 8 months ago

Having #84 hanging here for a while just due to gradients not being there, and then this getting merged is a bit... well, actually quite a bit — insulting.

Hey @cab404 I just got merge privileges on this repo today. I don't see any reason why we should hold up your PR because of gradients. Is there anything else you wanted to do to it or should I merge it?

cab404 commented 8 months ago

Is there anything else you wanted to do to it or should I merge it?

That would be nice, thank you!