This document explains how to use the POV-Ray SDL file callwood-ikebana-csg.inc
and describes some of the geometry.
The zip archive should contain these seven files:
callwood-ikebana-csg.css
callwood-ikebana-csg.html
callwood-ikebana-csg.inc
callwood-ikebana-csg.jpg
callwood-ikebana-cusp.png
callwood-ikebana-rim.png
callwood-ikebana-sloc.png
File callwood-ikebana-csg.inc
is the only file needed to create the object; the other files are all part of the documentation.
Requires POV-Ray version 3.5 or later.
Include this file once prior to using the macro:
#include "callwood-ikebana-csg.inc"
Including the file more than once is unnecessary, but harmless.
Macro CallwoodIkebanaCSG()
creates the object, untextured (except as described in the next section). The arguments are:
nPetals
R
Thickness
Edge
arNeck
arPetal
phiPetal
arHole
phiHole
arCusp
thetaCusp
All angles are in degrees.
The sample illustration uses CallwoodIkebanaCSG (8, 110, 3, 1.2, 7, 18.5, 60, 3.6, 6.3, 25, 30)
.
If CallwoodIkebanaCSG_t_Edge
is defined, then it will be used to texture the rounded edges. This is useful for visualizing some of the arguments for CallwoodIkebanaCSG()
.
CallwoodIkebanaCSG()
do not describe a well-formed object, the behavior of the macro will be undefined. In some cases, a parse error will result.
The key to CSG fanaticism is insane mathematical perfectionism. The following is for those who are interested in how the model was put together. It is not necessary to understand this in order to use the include file.
This theorem is used extensively to position the various parts of the object.
cos c = cos a cos b + sin a sin b cos C
where a, b, and c are the angular lengths of the sides of a spherical triangle; and C is the angle of the vertex opposite line c.
CallwoodIkebanaCSG_SOpposite()
Straightforward inverse cosine.
CallwoodIkebanaCSG_SAdjacent()
cos c = ±√(1 − sin2a) cos b + sin a sin b cos C
cos c − sin a sin b cos C = ±√(1 − sin2a) cos b
cos2c + sin2a sin2b cos2C − 2 cos c sin a sin b cos C = (1 − sin2a) cos2b
cos2c + sin2a sin2b cos2C − 2 cos c sin a sin b cos C = cos2b − sin2a cos2b
sin2a sin2b cos2C + sin2a cos2b − 2 cos c sin a sin b cos C + cos2c − cos2b = 0
(sin2b cos2C + cos2b) sin2a − (2 cos c sin b cos C) sin a + (cos2c − cos2b) = 0
Now solve the quadratic equation for sin a, and take an inverse sine.
CallwoodIkebanaCSG_SAngle()
cos c − cos a cos b = sin a sin b cos C
(cos c − cos a cos b) ⁄ (sin a sin b) = cos C
cos−1[(cos c − cos a cos b) ⁄ (sin a sin b)] = C
The cusps of the petals put a severe constraint on the sizes of the inner and outer rounded edges with respect to each other. This section shows how they were calculated.
My initial impression of Shay’s image was that the edge of the bowl was flat with rounded corners. Closer inspection of the image indicates that there may be only an illusion of flatness. If this is the case, having separate inner and outer rounded edges is overkill. Nevertheless, I am retaining this feature, not only for the sake of freedom of choice, but because I put so much work into it (involving a geometry error and two dead ends) and my ego won’t let it go.
An almost completely round edge may be rendered by passing an Edge
argument that is exactly half the size of Thickness
. (Calculating the exact Edge
value required for a completely round edge will likely make no visual difference.)
R, t, and φ are given.
By the law of sines, ro ⁄ sin φ = (R − ro) ⁄ sin 90°
ro ⁄ sin φ = R − ro
ro ⁄ sin φ + ro = R
ro + ro sin φ = R sin φ
ro (1 + sin φ) = R sin φ
ro = R sin φ ⁄ (1 + sin φ)
By the law of sines, ri ⁄ sin φ = (R − t + ri) ⁄ sin 90°
ri ⁄ sin φ = R − t + ri
ri ⁄ sin φ − ri = R − t
ri − ri sin φ = (R − t) sin φ
ri (1 − sin φ) = (R − t) sin φ
ri = (R − t) sin φ ⁄ (1 − sin φ)
By the Pythagorean theorem, ro2 + (R − bo)2 = (R − ro)2
ro2 + R2 − 2Rbo + bo2 = R2 − 2Rro + ro2
−2Rbo + bo2 = −2Rro
bo2 − 2Rbo + 2Rro = 0
By the quadratic formula, bo = R ± √(R2 − 2Rro)
R − bo = R − [R ± √(R2 − 2Rro)]
R − bo = ±√(R2 − 2Rro); R − bo > 0
R − bo = √(R2 − 2Rro)
bo = R − √(R2 − 2Rro)
Similar triangles: (R − t + bi) ⁄ ri = (R − bo) ⁄ ro
R − t + bi = ri (R − bo) ⁄ ro
bi = ri (R − bo) ⁄ ro − R + t
Variable | SDL Identifier | Comments |
---|---|---|
R | R |
|
t | Thickness |
|
R − t | rc3_RInner |
|
φ | rc3_aMargin |
Derived from the Edge argument |
ro | rc3_rOuter_edge |
|
ri | rc3_rInner_edge |
|
bo | rc3_Outer_depth |
|
bi | rc3_Inner_depth |
This feature uses the Pythagorean theorem and the law of cosines. The code should be easy to follow from this diagram.
Newsgroup thread | Constructive solid geometry (CSG)