Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #911

Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you?

From Luser droog <mijoryx@yahoo.com>
Newsgroups comp.lang.postscript
Subject Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you?
Date 2012-09-02 16:04 -0500
Organization Netfront http://www.netfront.net/
Message-ID <k20hls$433$1@adenine.netfront.net> (permalink)
References (6 earlier) <5638890b-933f-4f37-9635-7fbd3daec2c5@googlegroups.com> <67041f2e-e3e3-44e6-99ee-3d4accbaed25@googlegroups.com> <1h6zz5p1ua7nx$.1bghff5yydx4a$.dlg@40tude.net> <k1mjct$2pld$1@adenine.netfront.net> <1crb2uv6n8aor$.ypijta16vm02.dlg@40tude.net>

Show all headers | View raw


tlvp wrote:

> On Wed, 29 Aug 2012 21:32:52 -0500, Luser droog wrote:
> 
>> tlvp wrote:
>> 
>>> On Thu, 23 Aug 2012 23:58:25 -0700 (PDT), luser- -droog wrote:
>>> 
>>>> ...
>>>> Well, here's one way to add color.
>>>> The generator is really just a triple loop
>>>> 
>>>>   for x = -2.2 .. 2.2 step 1/res
>>>>     for y = -2.2 .. 2.2 step 1/res
>>>>       for z = -2.2 .. 2.2 step 1/res
>>>>         if (f(x,y,z)) { plot(x,y,z) }
>>>> 
>>>> So the "sweep" is along the x-axis of the object
>>>> (ie. pre-rotation). So if we snag the x coord
>>>> and shift and scale it to 0..1, we can get a
>>>> rainbow with sethsbcolor (my go-to color trick).
>>>> The nice benefit is that it turns pale blue
>>>> right in the center where the cross section becomes
>>>> a circle. Everywhere else it's a truncated circle
>>>> or a square.
>>>> 
>>>> I've also reduced the number and size of the points
>>>> and tweaked the fuzz to get more moire.
>>>> 
>>>> 49(1)01:43 AM:ps 0> cat 3d2.ps
>>>> %!
>>>> % Point-field sampling
>>>> % with data caching (in a file),
>>>> % point-wise axial rotations,
>>>> % and perspective projection
>>>> % and color.
>>>> 
>>>>  ... [details snipped] ...
>>>> 
>>>>     /flushpage where {pop flushpage} if
>>>>     showpage
>>>> } for
>>> 
>>> The color adds very nicely to the effect, thank you, moy droog :-) .
>>> 
>>> Two things keep surprising me, though, in the graphics swept out: first,
>>> the large number of times the eye beholds squares unfolding; and,
>>> second, the total absence of any swept out figures whose silhouette is a
>>> disc.
>>> 
>>> After all, peering straight at the figure directly along any of the
>>> three principal axes (x-axis, y-axis, z-axis) should reveal a circular
>>> outline.
>>> 
>>> The squares are the cartographic "contour level-lines" with respect to
>>> heights measured along those axes, but small squares near the top and
>>> bottom should grow as squares only up to a certain point, and then start
>>> to balloon out to become more and more circle-like, finally becoming a
>>> true circle at mid-height exactly. Why doesn't that strike the eye more
>>> blatantly, at least occasionally?
>>> 
>>> I know, it sounds like "Mrrble, mrrble, grubs again!" but it's not,
>>> really, I'm just curious :-) ... and hoping maybe to catch a glimpse of
>>> a tiny variation in how to compute (or to color) the lines being drawn,
>>> so as better to capture the spirit of that Steinmetz Solid. And, in the
>>> meantime, I think what you have is great! Again, my thanks!
>>> 
>> 
>> Well, I think to make any real progress, we need to transform it into
>> an easier-to-calculate form. Casselman frequently uses parametrization,
>> so I thought that was the thing to do. So,
>> 
>> Max(x^2+y^2, y^2+z^2, x^2+z^2)=4
>> 
>> If we take x=r*cos t, y=r*sin t, then for one "third" of the shape,
>> 
>> r^2 * cos^2 t + r^2 * sin^2 t = 4
>> r^2 (sin^2 t + cos^2 t) = 4
>> r = +/- 2
>> 
>> and 0 < t < 2pi
>> 
>> That reduces it to 2 variables t and z, right?
>> But I'm not sure what to do next. Keep z as it is?
>> Or convert it to an angle, too?
>> 
>> I think I'll go back to the simple side and try to draw
>> the cylinders themselves as wireframes (circles one way,
>> rectangles the other two). Then I should be able to
>> draw each one constrained by the other two, I think.
>> 
>> 
>> --- Posted via news://freenews.netfront.net/ - Complaints to
>> news@netfront.net ---
> 
> Here's another way to think of the geometric object itself.
> 
> Start by picturing a cube -- sides of length 4, say -- with spindle-shafts
> drilled perpendicularly through it at each face.
> 
> Now chuck it (with the help of a spindle through one of those shafts), and
> lathe-turn it down until everything at distance 2 or more from the center
> of rotation is cut away. See it? A cylinder of height 4 and diameter 4.
> 
> Now pick a new shaft, chuck it with help of a spindle through that shaft,
> and turn it down until everything at distance 2 or more from the center of
> rotation is cut away. See it? A "roundly beveled former cylinder ... ."
> 
> Now, using a spindle through the last shaft, chuck it again, and proceed
> as earlier, i.e., turn it down until everything at distance 2 or more from
> the center of rotation is cut away. See it? The Steinmetz Solid.
> 
> Think there's any hope of showing how it's gradually revealed through that
> last lathe-turning procedure?
> 
> Me, I'm just not up to keeping tabs on all the recursion/iteration needed.
> 

I can definitely imagine it better after reading this.
But drawing it? Not so sure. To simulate a lathe, we need
a material that can be cut and removed. That would lead
me back toward the point-field. Then we could maybe animate 
a tool revolving and deactivate the corresponding points in
the field. But I think it would be painfully slow.

This one simplifies (perhaps too much) the shape to projected
polygon rings. Imagine a big hotel atrium with a suspended
sculpture of hula-hoops and you're ascending upon it in the
glass elevator.

This looks worse than the previous, but I still consider it
a step forward because the calculation is more elegant. 
Most of the execution time of the other program is calculating
points that fail to show up. Because it has to make sure not
to draw them.

Now with this wireframe, I think I can evolve it to "fill-in"
the gaps and make rectangles out of points in corresponding
rings. Then we can get a normal vector for the "face" and
only draw the "front" of the shape. 

The other -lemma is finally learning how those matrix projections
work. And to squash the rotation sequence into a single matrix.
That seems to call for a fully-general matrix multiplication
routine. And a utility to do transposes. Of course I know these
things exist, but to "own" it, I have to write my own. Even if it's
straight from some wikipedia pseudocode. It's like a Hunter Thompson
thing. Where he re-typed the works of Hemmingway to know what 
it felt like to write those books. Once I've written my own version
of something, I'm on the inside of it rather than the outside.
Like gematria.

Anyhoo. On to the picture.

554(1)03:41 PM:ps 0> cat 3d3.ps
%!
/.setlanguagelevel where { pop 2 .setlanguagelevel } if

% x y z ang -> x y' z'
/rotx { 3 dict begin
    /theta exch def
    /z exch def
    /y exch def
    y theta cos mul
    z theta sin mul sub
    y theta sin mul
    z theta cos mul add
end } def

% x y z ang -> x' y z'
/roty { 4 dict begin
    /theta exch def
    /z exch def
    /y exch def
    /x exch def
    x theta cos mul
    z theta sin mul add
    y
    x theta sin mul neg
    z theta cos mul add
end } def

% x y z ang -> x' y' z
/rotz { 4 dict begin
    /theta exch def
    /z exch def
    /y exch def
    /x exch def
    x theta cos mul
    y theta sin mul sub
    x theta sin mul
    y theta cos mul add
    z
end } def

% Eye coords
/ex .2 def
/ey .2 def
/ez 5 def

% x y z -> X Y
/project {
%ang roty
%ang .25 mul rotx
%alpha rotz
beta roty
gamma rotx
3 dict begin
    /z exch def
    /y exch def
    /x exch def
    1 ez z sub div
    x ez mul z ex mul sub
    1 index mul
    y ez mul z ey mul sub
    3 2 roll mul
end } def


/moveto { z project //moveto } def
/lineto { z project //lineto } def

%h R N
/cylinder { 2 dict begin
    /N exch def
    /R exch def
    /h exch def
    /dz 1 N div def
    /dt 360 dz mul def

    0 dz 1 {
        h mul h 2 div sub /z exch def
        R 0 moveto
        0 dt 360 {
            dup cos R mul
            exch sin R mul
            lineto
        } for
        closepath
    } for

end } def

%/alpha 0 def
/beta 0 def
/gamma 0 def
0 10 180 { /ang exch def
    /ey ang 180 div 5 mul 2.5 sub def

    /dep 30 def
    300 400 translate
    60 dup dup scale 1 exch div setlinewidth

    %/alpha ang def
    /beta 0 def
    /gamma 0 def
    4 2 dep cylinder

    %/alpha ang def
    /beta 90 def
    /gamma 0 def
    4 2 dep cylinder

    %/alpha ang def
    /beta 0 def
    /gamma 90 def
    4 2 dep cylinder

    %gsave %false upath
    %erasepage
    %grestore %uappend
    stroke
    /flushpage where { pop flushpage } if
    %copypage
    showpage

} for




--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-17 04:48 -0400
  Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-07-17 08:16 -0700
    Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-17 19:25 -0400
  Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-08-17 23:40 -0700
    Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-08-18 00:14 -0700
      Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-18 22:44 -0400
        Moire Madness! Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-08-23 13:00 -0700
          Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-24 01:45 -0400
            Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-24 01:49 -0400
            Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-08-23 23:11 -0700
              Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? luser- -droog <mijoryx@yahoo.com> - 2012-08-23 23:58 -0700
                Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-25 02:17 -0400
                Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? Luser droog <mijoryx@yahoo.com> - 2012-08-29 18:25 -0500
                Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? Luser droog <mijoryx@yahoo.com> - 2012-08-29 21:32 -0500
                Re: Moire Madness! Re: ping luser- -droog: SVG or PS project for you? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-08-30 05:26 -0400
                Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you? Luser droog <mijoryx@yahoo.com> - 2012-09-02 16:04 -0500
                Re: Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you? Luser droog <mijoryx@yahoo.com> - 2012-09-03 12:29 -0500
                Re: Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you? Luser droog <mijoryx@yahoo.com> - 2012-09-04 12:04 -0500
                Re: Hula-Hoop Hullaballoo! Re: ping luser- -droog: SVG or PS project for you? "M. Joshua Ryan" <mijoryx@yahoo.com> - 2012-09-04 12:49 -0500
                A shaded cylinder luser- -droog <mijoryx@yahoo.com> - 2012-09-04 18:11 -0700
                Re: A shaded cylinder luser- -droog <mijoryx@yahoo.com> - 2012-09-11 13:03 -0700
                Spinning Steinmertz Solid (approx.) luser- -droog <mijoryx@yahoo.com> - 2012-09-11 21:29 -0700
                Mulligan (again) luser- -droog <mijoryx@yahoo.com> - 2012-09-13 19:07 -0700
                Re: Mulligan (again) tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-14 05:05 -0400
                Heineken time "luser.droog" <luser.droog@gmail.com> - 2012-09-15 16:50 -0500
                Bigger and Badderer "luser.droog" <luser.droog@gmail.com> - 2012-09-16 23:33 -0500
                Re: Bigger and Badderer "luser.droog" <luser.droog@gmail.com> - 2012-09-16 23:37 -0500
                QapplaH! "luser.droog" <luser.droog@gmail.com> - 2012-09-17 11:34 -0500
                Re: QapplaH! (appendix: updated mat.ps) "luser.droog" <luser.droog@gmail.com> - 2012-09-17 13:05 -0500
                one more cup of coffee for the road. "luser.droog" <luser.droog@gmail.com> - 2012-09-18 02:51 -0500
                Re: Bigger and Badderer tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-18 21:52 -0400
                Re: Bigger and Badderer "luser.droog" <luser.droog@gmail.com> - 2012-09-18 22:30 -0500
                Re: Bigger and Badderer tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-09-19 00:59 -0400
                Re: Bigger and Badderer "luser.droog" <luser.droog@gmail.com> - 2012-09-19 00:48 -0500
                Revolving Camera prototype "luser.droog" <luser.droog@gmail.com> - 2012-09-23 22:30 -0500
                Steinmetz with Revolving Camera "luser.droog" <luser.droog@gmail.com> - 2012-09-24 09:30 -0500

csiph-web