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


Groups > comp.lang.postscript > #890

Re: ping luser- -droog: SVG or PS project for you?

From luser- -droog <mijoryx@yahoo.com>
Newsgroups comp.lang.postscript
Subject Re: ping luser- -droog: SVG or PS project for you?
Date 2012-08-17 23:40 -0700
Organization http://groups.google.com
Message-ID <b578b27d-5292-4e14-9bea-51c334034ea6@googlegroups.com> (permalink)
References <1ca6lvkhx25dt.14pkcuyecuct2$.dlg@40tude.net>

Show all headers | View raw


On Tuesday, July 17, 2012 3:48:33 AM UTC-5, tlvp wrote:
> I'm not sure whether you're up to taking on others' tasks, but here's a
> 
> geometrical one my own PS and/or SVG capabilities just aren't up to at all.
> 
> 
> 
> I'd like to find code for getting 2D-projected views of the 3D object
> 
> whose x- and y- and z-coordinates (after suitable scaling, say) satisfy:
> 
> 
> 
> : Max [ x^2+y^2, x^2+z^2, y^2+z^2 ] = 4  (-2 <= x&y&z <= +2) .
> 
> 
> 
> You can visualize this as the result of starting with a 4-inch length of
> 
> two-inch radius wooden doweling (that helps assure, say, x^2+y^2 <= 4),
> 
> spinning it against a belt sander with spinning axis perpendicular to --
> 
> and bisecting -- the central axis from the one disc-shaped end to the other
> 
> until you've removed enough material to assure x^2+z^2 <= 4 (if it were a
> 
> stubby D cell battery, it would be spinning end over end, grinding the +
> 
> and - poles down until they're well rounded, sort of), and then using a
> 
> third axis perpendicular to the two axes already mentioned as a spinning
> 
> axis for grinding down the last bits (still at the + and - poles), to
> 
> assure y^2+z^2 <= 4.
> 
> 
> 
> [If you have Mathematica, tell it you want it to give you
> 
> 
> 
> : RegionPlot3D[Max[x^2+y^2,x^2+z^2,y^2+z^2]<=4,{x,-2,2},{y,-2,2},{z,-2,2}]] .
> 
> 
> 
> (Or try with the last 6 instances of the values "2", in the braces,
> 
> replaced by "2.01".)
> 
> With Maple, I suspect some very similar formulation will work as well. But
> 
> I have neither of them, and Wolfram|Alpha balks at giving the help I want.]
> 
> 
> 
> Anyway, viewed "head-on" from the perspective of any of those three axes,
> 
> the resulting object has circular silhouette. Viewed from virtually any
> 
> other perspective, not properly circular at all.
> 
> 
> 
> Any way to come up with a SVG animation showing views of this beast as
> 
> one's viewing angle varies from elevations of 0 up through 45 degrees,
> 
> and/or one's lateral angle varies between -45 and +45 degrees (leftward
> 
> and/or rightward), would be welcome. Or even just a short slide-show of PS
> 
> views :-) . (I think of your snowfkake iterations as a "slide-show" model.)
> 
> 
> 
> TIA, if possible; and no hard feelings if not. Cheers, -- tlvp
> 

Alright, version 1 has some obvious flaws.
But it looks really strange.
I think I should solve for z instead of sampling.
And there's no projection here, just dropping the z
(interpreting it as a grey value).

I borrowed heavily from my mandelbrot set program
in the use of `image`.

%!

/max {
    2 copy lt { exch } if pop
} def

%x y z  f  bool
/f {
    dup mul 3 1 roll    %z^2 x y
    dup mul 3 1 roll    %y^2 z^2 x
    dup mul 3 1 roll    %x^2 y^2 z^2
    2 index 2 index add %x^2 y^2 z^2  x^2+y^2
    3 index 2 index add %x^2 y^2 z^2  x^2+y^2  x^2+z^2
    3 index 3 index add %x^2 y^2 z^2  x^2+y^2  x^2+z^2  y^2+z^2
    max                 %x^2 y^2 z^2  x^2+y^2  max(x^2+z^2,y^2+z^2)
    max                 %x^2 y^2 z^2  max(x^2+y^2, max(x^2+z^2,y^2+z^2))
    4 1 roll pop pop pop %max(...)
    4 eq
} def

/tlvp {
    /res exch def  %resolution
    /str res string def  %1-row buffer
    /++ { dup load 1 add store } bind def  %increment proc
    /yc 0 def  %y cursor
    res res 8 [ res 0 0 res neg 0 res ]
    { %image
        0 1 res 1 sub { %for each byte of the string, incr x
            /xc exch def  %x cursor
            /x0 xc res div 4 mul 2 sub def  %
            /y0 yc res div 4 mul 2 sub def  %

            0 1 res 1 sub { %check all z values in range
                /zc exch def
                /z0 zc res div 4 mul 2 sub def
                x0 y0 z0 f {
                    str xc
                    z0 2 add 4 div 255 mul cvi
                    put
                } if
            } for
        } for
        /yc ++  %incr y for next row
        str  %yield string buffer to `image`
    } image
} def

612 612 scale
100 tlvp

showpage

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


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