Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #895
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Moire Madness! Re: ping luser- -droog: SVG or PS project for you? |
| Date | 2012-08-23 13:00 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <3cb138c8-2147-48a6-b90a-91c8cc7e6d29@googlegroups.com> (permalink) |
| References | <1ca6lvkhx25dt.14pkcuyecuct2$.dlg@40tude.net> <b578b27d-5292-4e14-9bea-51c334034ea6@googlegroups.com> <3d013aa0-e8c0-4db9-8a03-ed29b2eba2cf@googlegroups.com> <fg280ctdmlnb.61z3ivwjxw33$.dlg@40tude.net> |
On Saturday, August 18, 2012 9:44:21 PM UTC-5, tlvp wrote:
> On Sat, 18 Aug 2012 00:14:56 -0700 (PDT), luser- -droog wrote:
>
>
> > Forgot to clear the bytes, so it was smearing.
>
> > Now it uses 128 for a mid-grey background.
>
> > And a little fuzzy on the notion of equality
>
> > starts to bring it to life, I think.
>
> >
>
[snip]
>
>
> You've got it :-) ! ... But the "project z out of the picture" strategy
>
> loses the sort of perspective that gives a better feel for the object.
>
>
>
> It's a so-called "Steinmetz Solid" (q.v. -- midway down the first page of
>
> Google hits, as they come up for me, are some neat small renditions of it).
>
I've made a little progress here. It still generates the points
with the O(n^3) brute force algorithm, but it saves the points
to a data file called "stein.pts" so subsequent pages are much
less agonizing.
Rotations and projections are applied to each point, and then
it draws a little circle to represent the projected point.
%!
% Point-field sampling
% with data caching (in a file),
% point-wise axial rotations,
% and perspective projection.
/fuzz 10000 def %the "grain" of eq
/oldeq /eq load def
/eq {
fuzz mul round exch fuzz mul round oldeq
} def
/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
/filename (stein.pts) def
/low -2.2 def
/hi 2.2 def
%generate data by brute force, cache in file, plot
/pointfieldtocache {
/res exch def
/dt 1 res div def
/fuzz res .5 mul def
%fuzz affects the "closeness" of
%the equality test. a lower fuzz will allow more
%values to be equal.
% 'res' gives thin lines
% 'res .5 mul' gives wider "ribbons"
/outfile filename (w) file def
/outbuf 128 string def
low dt hi {
low dt hi {
low dt hi { % xW yW zW "world" coords
3 copy f {
3 copy 3 -1 1 { -1 roll
outbuf cvs outfile exch writestring
outfile (\n) writestring
} for %dump points to file
3 copy project
%2 copy exch = =
%2 copy transform exch = = ()=
2 copy 2 copy moveto dt .5 mul 0 360 arc moveto
fill
/flushpage where {pop flushpage} if
} if
pop
} for
pop
} for
pop
} for
outfile closefile
} def
%plot cached data from file
/pointfieldfromcache {
/res exch def
/dt 1 res div def
/infile filename (r) file def
/it 1 def
%cvx exec
%count 3 idiv {
{
{
/it it 1 add def
infile token not {stop} if % bail-out
infile token not {stop} if % on any datafile issues
infile token not {stop} if
%3 copy
project
2 copy 2 copy moveto dt .5 mul 0 360 arc moveto
it res mod 0 oldeq {
fill /flushpage where {pop flushpage} if
} if
} loop
} stopped pop
%} repeat
} def
/pointfield { %check if there's a readable data file
{ filename (r) file closefile } stopped not
//pointfieldfromcache %yes! read it.
{ pop pop pointfieldtocache } ifelse %no! make one.
} def
% x y z ang -> x y' z'
/rotx {
/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
} def
% x y z ang -> x' y z'
/roty {
/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
} def
% x y z ang -> x' y' z
/rotz {
/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
} def
% Eye coords
/ex .2 def %a little x-y skew adds "drama"
/ey .2 def
/ez 5 def
% x y z -> X Y
/project {
ang roty
ang .25 mul rotx
/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
} def
10 10 360 {
/ang exch def
%matrix currentmatrix
300 400 translate
100 100 scale
60 pointfield
%setmatrix fill
/flushpage where {pop flushpage} if
showpage
} for
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar
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