First of all, please excuse me for being vague in the title, I really can't
explain my problem very well in few words. Mind you, English is not my
native tongue and though through practice I have become fluent, I am too
ignorant when it comes to terminology.
So.
I am making an ellipse. I have taken the equation, made a function that
gives me a quarter of the ellipse and then I use a loop that through a use
of the polygon creates the shape, which is the extruded and rotated. So far
so good.
What I want to do is to remove bits from the top part (the edge of the
curve?). These bits would have to
->have the shape of hexagons (hence beehive in the title)
->be vertical to the curving surface of my extruded ellipse (which I suppose
can be done by a use of derivatives, for which I have already made a
function)
->keep an equal distance between each other
In other words, what would ideally result would be a beehive shape curved as
an ellipse.
I hope I have explained my case.
For reference, here are the bits of code I have:
function f(x,R,L) = sqrt(pow(R,2)-pow(x*R/L,2));
where R is the maximum height and L the Length
function r_f(x,R,L,x1,y1) = (Rx1/(asqrt(pow(a,2)-pow(x1,2))))*(x-x1)+y1;
Please don't shoot me, I used an online tool to calculate the derivative
because we haven't covered that part of the syllabus at school yet, so I
have no idea how wrong this could be.
The piece of code that creates the quarter of the ellipse is this:
rotate([90,0,0])
linear_extrude(height=8,center=true)
for(x1=[0:step:Length-step]){
y1=f(x1,Radius,Length);
x2=x1+step;
y2=f(x2,Radius,Length);
polygon([[x1,0],[x1,y1],[x2,y2]]);
polygon([[x1,0],[x2,y2],[x2,0]]);
}
P.S.: I understand that my code is a bit inefficient, but please bare with
me.
--
View this message in context: http://forum.openscad.org/Difference-Beehive-Sorta-tp14030.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
You might want to look at this thread
http://forum.openscad.org/Need-help-on-Render-td13624.html
--
View this message in context: http://forum.openscad.org/Difference-Ellipse-Beehive-Sort-of-tp14030p14031.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Let me first give you the bad news - what you want to do cannot be done. With
that I mean using regular hexagons on the surface of a three-dimensional
shape. That you want a shape in three dimensions I take from your reference
to a beehive.
Why not? Go back to your geometry classes years ago. There you were taught
about inner and outer angles. Add up the outer angles of a triangle, square
or hexagon, you name it. They all add up to 360 degree. Now build a second
ring around that triangle, square or hexagon. If you can lay new ones all
around the original one without a gap, you cannot build a three-dimensional
shape from them. Regular polyhedrons (called Platonic bodies, see Wikipedia)
can have as outer surfaces only regular triangles, squares or pentagons -
nothing else is possible.
So - if not accurately, what about approximately?
There is a standard way to go about constructing shapes that are not within
the library. Google for the equation of the shape you want in polar
coordinates. In your case, since you want, I assume, a three-dimensional
ellipse (called an ellipsoid), google for
ellipsoid equation polar coordinates
With the equation found there (by the way, your equation,function f(x,R,L) =
sqrt(pow(R,2)-pow(x*R/L,2));, is the equation of a circle in cartesian
coordinates, not an ellipse) you can construct the ellipsoid using little
cubes. The trouble using this method is, cubes have sharp edges, and to
smooth them away, you need lots of them. So it is a good idea to replace the
cubes with square columns, where one of the squares is centered in the
origin and the other on the surface of your ellipsoid. The length of the
column is the radius of your ellipsoid, as per polar coordinate equation.
I'll give you the link
http://mathworld.wolfram.com/Ellipsoid.html
to all the equations you need, but don't ask me to program it for you. That
is an exercise in itself. But in case you struggle with my words, here is
the code for an ellipse in two dimensions:
module MyEllipse()
for(i=[0:10:360])
{ r=AB/sqrt(AAsin(i)sin(i)+BBcos(i)*cos(i)); //Radius of an ellipse
in polar coordinates
{ rotate(i,[1,0,0])
cube([.2,r,.1],center=true);
}
}
This module by itself produces a sort of star with 360/10 rays.
http://forum.openscad.org/file/n14032/Star.jpg
Hull() it and you get an ellipsoid disk with flat, rectangular sides.
Add two somewhat smaller ellipsoids to it, rotated by half a step, and you
get your first glimpse of what you are after: a portion of an ellipsoid with
hexagons on its surface. But these hexagons are folded, they are not flat.
That is how an approximation ends: you get some of what you wanted, but not
all.
http://forum.openscad.org/file/n14032/Star1.jpg
The full code is
Step=10;
hull()
{ translate([1,0,0]) MySmallEllipse();
MyLargeEllipse();
translate([-1,0,0]) MySmallEllipse();
}
module MyLargeEllipse()
{A=25; //long half-axis of ellipse
B=10; //short half-axis of ellipse
for(i=[0:Step:360])
{ r=AB/sqrt(AAsin(i)sin(i)+BBcos(i)cos(i)); //Radius of an
ellipse in polar coordinates
{ rotate(i,[1,0,0])
cube([1,r,.1],center=true);
}
}
}
module MySmallEllipse()
{A=23.75; //long half-axis of ellipse
B=9.5; //short half-axis of ellipse
for(i=[Step/2:Step:360+Step/2])
{ r=AB/sqrt(AAsin(i)sin(i)+BB*cos(i)*cos(i)); //Radius of an
ellipse in polar coordinates
{ rotate(i,[1,0,0])
cube([.1,r,.1],center=true);
}
}
}
--
View this message in context: http://forum.openscad.org/Difference-Ellipse-Beehive-Sort-of-tp14030p14032.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
First of all, thanks. Both of you have helped me immensely. I shall mull over
the subject and then try to create my own solution. I am now aware accuracy
cannot be achieved, but a very close approximation will do for what I have
in mind.
You see, I am a student and there are things that haven't been covered at
school yet.
Nevertheless, according to my book of analytical geometry (the standard for
the student body), the equation for eclipses centered on (0,0) is
(x^2/a^2)+(y^2/b^2)=1, with the foci being (c,0) and (-c,0), where
c=sqrt(a^2-b^2), which means my function does create part of an ellipse.
Then I extrude. I don't really have to make a true ellipsoid, only a
very-much 2d ellipse extruded vertically.
Anyway, I appreciate your answers and I will integrate them to the solution.
I shall update if/when I make my move.
--
View this message in context: http://forum.openscad.org/Difference-Ellipse-Beehive-Sort-of-tp14030p14033.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
We had a long discussion about extrusion along an ellipse some way back:
http://forum.openscad.org/Rotary-extrude-with-constant-wall-thickness-plz-help-td13287.html
You'll probably find some ideas there.
2015-09-29 13:35 GMT+02:00 Jimmis98 anonimos79violin@gmail.com:
First of all, thanks. Both of you have helped me immensely. I shall mull
over
the subject and then try to create my own solution. I am now aware accuracy
cannot be achieved, but a very close approximation will do for what I have
in mind.
You see, I am a student and there are things that haven't been covered at
school yet.
Nevertheless, according to my book of analytical geometry (the standard for
the student body), the equation for eclipses centered on (0,0) is
(x^2/a^2)+(y^2/b^2)=1, with the foci being (c,0) and (-c,0), where
c=sqrt(a^2-b^2), which means my function does create part of an ellipse.
Then I extrude. I don't really have to make a true ellipsoid, only a
very-much 2d ellipse extruded vertically.
Anyway, I appreciate your answers and I will integrate them to the
solution.
I shall update if/when I make my move.
--
View this message in context:
http://forum.openscad.org/Difference-Ellipse-Beehive-Sort-of-tp14030p14033.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org