|
|
As long as everyone else is posting glasswares they've made, figured I'd
join the bandwagon. The glass is completely CSG (one of my first in fact).
#macro cup1(h,tr,br,lh)
// cup hole
#declare cup_interior=
difference {
intersection {
cone { // Basic interior cone shape
<0,.5,0>, br-.25
<0,h+.000001,0>, tr-.05
}
sphere { // Bottom rounding
<0,h-1.5,0>, h-2
}
}
torus { // Wall curving
(br-.25)+h*2.77*cos(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)+pow(h,2))
/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05)))), h*2.77
translate y*h*2.77*sin(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)+pow(h,2))
/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05))))
}
hollow
}
// cup
#declare cup =
merge {
difference {
cone { // Outer cone shape
<0,0,0>,br
<0,h,0>,tr
}
difference{ // curve from side to base
intersection{
cone {
<0,0,0>,br
<0,h,0>,tr
}
plane{y,.2}
}
union{
torus{br-.2,.2 translate y*.2}
cylinder{<0,0,0>,<0,.2,0>br-.2}
}
translate y*-.000001
}
object{cup_interior}
torus { // Outter wall curve
br+h*2.62*cos(pi-acos(sqrt(pow(br-tr,2)+pow(h,2))/(2*h*2.62))
-atan(h/abs(br-tr))), h*2.62
translate y*h*2.62*sin(pi-acos(sqrt(pow(br-tr,2)+pow(h,2))/(2*h*2.62))
-atan(h/abs(br-tr)))
}
//base cut
cone{<0,-.000001,0>,br-.2 <0,.2,0>,.2}
// end base cut
}
torus { // Lip toroid
(tr-.01), .05
translate y*h
}
hollow
}
// liquid volume
#declare cup_content=
difference{
intersection{
object{cup_interior}
plane{y,lh}
}
merge{ // adds water climbing sides effect
torus{
(br-.25)+h*2.77*cos(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)
+pow(h,2))/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05))))
-sqrt(pow(h*2.77,2)
-pow(h*2.77*sin(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)
+pow(h,2))/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05))))-lh,2))-0.15
,.3
}
cylinder{
<0,-.3,0>,<0,.3,0>,
(br-.25)+h*2.77*cos(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)
+pow(h,2))/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05))))
-sqrt(pow(h*2.77,2)
-pow(h*2.77*sin(pi-acos(sqrt(pow((br-.25)-(tr-.05),2)
+pow(h,2))/(2*h*2.77))-atan(h/abs((br-.25)-(tr-.05))))-lh,2))-0.15
}
translate (lh+.15)*y
}
hollow
}
#end
Post a reply to this message
Attachments:
Download 'glass_cup.jpg' (63 KB)
Preview of image 'glass_cup.jpg'
|
|
|
|
The glass shape is kinda strange because it's supposed to have a handle on
it, but I never got around to doing that since I wanted the glass to
begenerated by a couple dimensions (everything I did CSG back then was like
that). The way it is now though are the same dimensions as the one I got
for being a groomsman for a friend (minus 1 or 2 details).
Since you all like the tile surface so much here's the code for that.
#declare side = 4;
#declare R1 = seed(19);
#declare tile=
object{
#if(!quick_render)
superellipsoid{<.05,.05>}
#else
box {<-1,-1,-1>,<1,1,1>}
#end
scale <side/2,.125,side/2>*.99
}
#declare m_tile=
material{
texture{
T_Stone26
finish{
Phong_Shiny
reflection { 0.5 , 1.0
fresnel on
metallic 0.8
}
conserve_energy
}
translate rand(R1)*10 scale 2
}
}
#macro Tile_Surface (xdir,zdir)
#local CountX=0;
#while (CountX<xdir)
#local CountZ=0;
#while (CountZ<zdir)
object{
tile
translate <((xdir-1)/2)*(side+.1)-CountX*(side+.1)
,0,((zdir-1)/2)*(side+.1)-CountZ*(side+.1)>
#if (!quick_render)
material{m_tile}
#else
pigment{Red}
#end
}
#local CountZ=CountZ+1;
#end
#local CountX=CountX+1;
#end
box{ // grouting
<-((xdir)/2)*(side+.1),0,-((zdir)/2)*(side+.1)>,
<((xdir)/2)*(side+.1),.09,((zdir)/2)*(side+.1)>
pigment{Gray}
#if(!quick_render)
normal{granite scale .1} finish{Phong_Shiny}
#end
}
#end
#declare x_tiles=10;
#declare z_tiles=10;
#declare tbl_srfc=
union{
intersection{
union{
Tile_Surface(x_tiles,z_tiles) translate <0,-.12376,0>
}
cylinder{<0,-2,0>,<0,2,0>,1 // bounding for table surface
scale <x_tiles*side/2,1,z_tiles*side/2>
}
}
torus{5*side,.15 scale <1,2,1> translate y*-.3 texture{T_Wood24}} // edge
}
#if (obj_table)
object{
tbl_srfc
pigment{Black}
translate <-.5,80,-1>
}
#end
Post a reply to this message
|
|