Code cleaning + add ears to the bottle clip! #22

Open
ajabep wants to merge 23 commits from ajabep/scad:trunk into trunk
Showing only changes of commit 79710a9d66 - Show all commits

Add parameters to customize the ears at a script level

Ajabep 2026-01-15 21:36:34 +01:00

View file

@ -39,6 +39,30 @@ FORMAT = 0; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2
// Style of the ears to add... or not add. This parameter can add a LOT of calculation time.
EARS_STYLE = 0; // [0=No ears, 1=Just arcs, 2=Filled ears with the same thickness, 3=Filled ears with the a thinner thickness inside, 4=Filled ears with the same thickness but shifted]
/* [Ear Parameters] */
// Space between both ears.
SPACE_BETWEEN_EARS = 13; // .1
// The X orientation of the ears, to give a more organic look. Angle in degree
EAR_TILT = 15; // .1
// The depth of the ear
EAR_DEPTH = 2; // .1
// The thickness of the ear arcs
EAR_THICKNESS = .6; // .1
// The width of the ear
EAR_SIDE_LEN = 6;
// How much the ear is bent. 1 = half circle, 0.00001 = almost straight
EAR_BEND_FACTOR = 0.5; // [.01:.01:1]
// How much the ear is stretched, useful for fox ears or this kind of shapes
EAR_STRETCH_FACTOR = 1.2;
/* [Render] */
// Whether to render the clip, the body.
RENDER_COLOR_CLIP = true;
@ -134,13 +158,39 @@ module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
// Render ears if requested
if (ears_style > 0) {
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
ears(
ht=ht,
ru=ru,
rl=rl,
clip_width=width,
space_between_ears=SPACE_BETWEEN_EARS,
ear_tilt=EAR_TILT,
ear_depth=EAR_DEPTH,
ear_thickness=EAR_THICKNESS,
ear_side_len=EAR_SIDE_LEN,
ear_bend_factor=EAR_BEND_FACTOR,
ear_stretch_factor=EAR_STRETCH_FACTOR,
ears_style=ears_style
);
}
}
// Render ears if requested
if (ears_style > 0 && RENDER_COLOR_EARS) {
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
ears(
ht=ht,
ru=ru,
rl=rl,
clip_width=width,
space_between_ears=SPACE_BETWEEN_EARS,
ear_tilt=EAR_TILT,
ear_depth=EAR_DEPTH,
ear_thickness=EAR_THICKNESS,
ear_side_len=EAR_SIDE_LEN,
ear_bend_factor=EAR_BEND_FACTOR,
ear_stretch_factor=EAR_STRETCH_FACTOR,
ears_style=ears_style
);
}
}
}
@ -281,7 +331,7 @@ module outer_cutoff(rl, e, ru, ht, width) {
*
* ear_depth: the depth of the ear
* ear_thickness: the thickness of the ear arcs
* ear_side_len: the length of one side of the ear base triangle
* ear_side_len: the width of the ear
* ear_bend_factor: how much the ear is bent. 1 = half circle, 0.00001 = almost straight
* ear_stretch_factor: how much the ear is stretched, useful for fox ears or this kind of shapes
*
@ -507,7 +557,7 @@ module ears(ht, ru, rl, clip_width, space_between_ears = 15, ear_tilt = 15, ear_
*
* depth: the depth of the ear
* thickness: the thickness of the ear arcs
* side_len: the length of one side of the ear base triangle
* side_len: the width of the ear
* bend_factor: how much the ear is bent. 1 = half circle, 0.00001 = almost straight
* stretch_factor: how much the ear is stretched, useful for fox ears or this kind of shapes
*
@ -578,7 +628,7 @@ module ear_with_style(style = 1, depth, thickness, side_len=30, bend_factor=0.5,
*
* depth: the depth of the ear
* thickness: the thickness of the ear arcs
* side_len: the length of one side of the ear base triangle
* side_len: the width of the ear
* bend_factor: how much the ear is bent. 1 = half circle, 0.00001 = almost straight
* stretch_factor: how much the ear is stretched, useful for fox ears or this kind of shapes
*