POV-Ray : Newsgroups : povray.programming : Twisted Squares Server Time
24 Dec 2024 23:30:37 EST (-0500)
  Twisted Squares (Message 1 to 9 of 9)  
From: Edmund Horner
Subject: Twisted Squares
Date: 18 Oct 2000 03:14:06
Message: <39ed4dbe@news.povray.org>
I am considering how to render the shape of a "twisted square".

The shape is defined by four points, with a surface made of straight lines
forming a grid over the "square".  Apparently this is a quite reasonable
shape, and is useful for making surfaces.

But I do not think pov-ray provides it.  Anyone got any advice on how I best
go about adding it?

Edmund.


Post a reply to this message

From: Christoph Hormann
Subject: Re: Twisted Squares
Date: 18 Oct 2000 04:00:36
Message: <39ED58A4.D26C5D23@schunter.etc.tu-bs.de>
Edmund Horner wrote:
> 
> I am considering how to render the shape of a "twisted square".
> 
> The shape is defined by four points, with a surface made of straight lines
> forming a grid over the "square".  Apparently this is a quite reasonable
> shape, and is useful for making surfaces.
> 
> But I do not think pov-ray provides it.  Anyone got any advice on how I best
> go about adding it?
> 

It depends...

First of all, there is nothing like lines in povray, you would have to use
cylinders for that.  

making a grid of cylinders should not be a problem, just make 2 nested while
loops and build the cylinders according to a function (in megapov you could use
eval_pigment for example)

the sombrero.pov sample file that comes with povray does something like that
with spheres, you just have to modify it for cylinders connecting the points.

BTW, you should ask such questions in povray.newusers/povray.advanced-users,
because this group is for discussing questions concerning the povray source
code.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Warp
Subject: Re: Twisted Squares
Date: 18 Oct 2000 05:12:23
Message: <39ed6976@news.povray.org>
Edmund Horner <ejr### [at] paradisenetnz> wrote:
: The shape is defined by four points, with a surface made of straight lines
: forming a grid over the "square".  Apparently this is a quite reasonable
: shape, and is useful for making surfaces.

: But I do not think pov-ray provides it.  Anyone got any advice on how I best
: go about adding it?

  There's this kind of shape in VanSickle's matrix page. It may be exactly what
you are looking for. It's also fast to create and render.
  Look at the section called "The saddle" at:
http://users4.50megs.com/enphilistor/matrix.htm

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: Twisted Squares
Date: 18 Oct 2000 05:13:09
Message: <39ed69a5@news.povray.org>
And by the way, this newsgroup is about povray source code programming, not
about povray scene language.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Edmund Horner
Subject: Re: Twisted Squares
Date: 18 Oct 2000 06:57:14
Message: <39ed820a@news.povray.org>
Why thank you both _indeed_ for your quick replies.  It is _gratifying_ to
be told that I'm posting in the wrong group.

Unfortunately however my question does relate to the povray source.

The object I want to render has is mathematically reasonable, just as any
other povray primiative is.  And povray does not appear to support it.  I
_need_ to create a new primitive.

My question is: how do I create a new primitive?  It will be a finite patch
primitive (like polygon, etc.).  I know how to determine where a point in 3D
space is on the surface.  But I am not sure about how to calculate
intersections with rays, yet.

Given four points in space, A,B,C, and D, with line segments AB, and CD.
The surface is the set of all lines from each point on AB to its
corresponding point on CD.  (Corresponding means of the same ratio from the
ends of its line.)

I am assured that this is mathemetically well-defined.

Thanks,
Edmund.

"Edmund Horner" <ejr### [at] paradisenetnz> wrote in message
news:39ed4dbe@news.povray.org...
> I am considering how to render the shape of a "twisted square".
>
> The shape is defined by four points, with a surface made of straight lines
> forming a grid over the "square".  Apparently this is a quite reasonable
> shape, and is useful for making surfaces.
>
> But I do not think pov-ray provides it.  Anyone got any advice on how I
best
> go about adding it?
>
> Edmund.
>
>


Post a reply to this message

From: Warp
Subject: Re: Twisted Squares
Date: 18 Oct 2000 07:23:48
Message: <39ed8843@news.povray.org>
I answered your question in my previous post. Wasn't it enough?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Edmund Horner
Subject: Re: Twisted Squares
Date: 18 Oct 2000 07:40:13
Message: <39ed8c1d@news.povray.org>
Yes, it looks like the Saddle shape is what I'm looking for.  Thanks!  :)

However, had you not pointed it out to me, I would have embarked upon
construction of a new povray primitive (called twisted_square).  So I stand
by my decision to post to this group!

Many thanks,
Edmund.

"Warp" <war### [at] tagpovrayorg> wrote in message
news:39ed8843@news.povray.org...
>   I answered your question in my previous post. Wasn't it enough?
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: John VanSickle
Subject: Re: Twisted Squares
Date: 18 Oct 2000 08:34:15
Message: <39ED98C7.A0AC8C6@erols.com>
Edmund Horner wrote:
> 
> Why thank you both _indeed_ for your quick replies.  It is
> _gratifying_ to be told that I'm posting in the wrong group.
> 
> Unfortunately however my question does relate to the povray source.
> 
> The object I want to render has is mathematically reasonable, just as
> any other povray primiative is.  And povray does not appear to support
> it.  I _need_ to create a new primitive.

Only if you want the normals to be smoothed (which would be helpful).

> Given four points in space, A,B,C, and D, with line segments AB, and CD.
> The surface is the set of all lines from each point on AB to its
> corresponding point on CD.  (Corresponding means of the same ratio from the
> ends of its line.)
> 
> I am assured that this is mathemetically well-defined.

It is, and it is called the saddle.  It is described by the equation xy-z=0.
Your specifics call for clipping the surface to the region -1<=x<=1
intersected with -1<=y<=1.  You can also call it a bilinear Bezier patch.

The following macro will draw this object.

#macro Saddle(pA,pB,pC,pD)

#local vX=(pA-pB-pC+pD)/4;
#local vY=(pA+pB-pC-pD)/4;
#local vZ=(pA-pB+pC-pD)/4;
#local vM=(pA+pB+pC+pD)/4;

quadric { <0,0,0>,<1,0,0>,<0,0,-1>,0
  hollow
  clipped_by { box { -1,1 } }
  bounded_by { clipped_by }
  matrix < vX.x,vX.y,vX.z, vY.x,vY.y,vY.z, 
           vZ.x,vZ.y,vZ.z,vM.x,vM.y,vM.z >
}
#end

It would be used this way:

union {
  Saddle(PointA,PointB,PointC,PointD)
  Saddle(PointD,PointC,PointE,PointF) // note change in order of C and D
  // etc
  texture { MyTexture }
}

If you try this, you will note that the surfaces of these patches are
not necessarily continuous at the edges; to eliminate the sudden changes
in shading that will result, normal interpolation is needed; you can
either simulate the patch with four smoothed triangles, or create a
new primitive.

If you want to make a new primitive, you can always download the POV
source, figure out how it works, add the code that will accomplish what
you want, and re-compile it.  Several people have done this.

Regards,
John


Post a reply to this message

From: Disnel
Subject: Re: Twisted Squares
Date: 20 Oct 2000 08:49:14
Message: <39F0405A.46FAD754@hlavacek-partner.cz>
Perhaps you are looking for hyperbolic paraboloid shape,
which can be implemented using POV quadric object.

See http://mathworld.wolfram.com/HyperbolicParaboloid.html
for this shape details.

Disnel

Edmund Horner wrote:
> 
> I am considering how to render the shape of a "twisted square".
> 
> The shape is defined by four points, with a surface made of straight lines
> forming a grid over the "square".  Apparently this is a quite reasonable
> shape, and is useful for making surfaces.
> 
> But I do not think pov-ray provides it.  Anyone got any advice on how I best
> go about adding it?
> 
> Edmund.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.