POV-Ray : Newsgroups : povray.general : supershapes in povray : Re: supershapes in povray Server Time
5 Nov 2024 03:17:21 EST (-0500)
  Re: supershapes in povray  
From: Tor Olav Kristensen
Date: 13 Jul 2003 12:24:40
Message: <Xns93B7BBA00DE90torolavkhotmailcom@204.213.191.226>
ingo <ing### [at] tagpovrayorg> wrote in
news:Xns### [at] povrayorg: 

> in news:pdb### [at] netplexaussieorg Paul
> Bourke wrote:
> 
>>     http://astronomy.swin.edu.au/~pbourke/surfaces/supershape3d/
>> 
> 
> Paul,
> 
> on that page you write "One is to use the builtin parametric
> primitive, doing it this way would result in ...". Do you have a scene
> using the parametric primitive available? I'd like try it with my
> param.inc macro ( http://members.home.nl/seedseven/ ) as it uses a
> syntax very close to the parametric primitive, but to be honest I'm
> too lazy to figure it out for myself.


Hi Ingo

Below is a "super shape" scene that uses your Parametric() macro.


Tor Olav


// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#version 3.5;

#include "param.inc"

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

#macro SuperFunction(M, A, B, N1, N2, N3)

  #local Nil = 1E-12;
  #local MM = M/4;
  #local NN = -1/N1;

  function(T) {
    pow(
      Nil +
      pow(abs(cos(T*MM)/A), N2) +
      pow(abs(sin(T*MM)/B), N3),
      NN
    )
  }

#end // macro SuperFunction


#macro SuperShapeMesh(
         M1, A1, B1, N11, N12, N13,
         M2, A2, B2, N21, N22, N23,
         ResTh, ResPh)

  #local SuperFn1 = SuperFunction(M1, A1, B1, N11, N12, N13)
  #local SuperFn2 = SuperFunction(M2, A2, B2, N21, N22, N23)

  Parametric(
    function(Th, Ph) { cos(Th)*SuperFn1(Th)*cos(Ph)*SuperFn2(Ph) },
    function(Th, Ph) { sin(Ph)*SuperFn2(Ph) },
    function(Th, Ph) { sin(Th)*SuperFn1(Th)*cos(Ph)*SuperFn2(Ph) },
    <-pi, -pi/2>, <pi, pi/2>,
    ResTh, ResPh, ""
  )

#end // macro SuperShapeMesh

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

object {
  SuperShapeMesh(
    1, 1, 1  77, 0.81, 71.7,
    8, 1, 1, 0.63, 2.92, 0.24,
    100, 50
  )
  pigment { color rgb <1, 1, 1> }
  double_illuminate // Because of bug
  no_shadow
}

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7

camera {
  location <3, 2, 4>*0.6
  look_at <0, 0, 0>
}

light_source { 100*x color rgb <1.0, 0.5, 0.5> }
light_source { 100*y color rgb <0.5, 1.0, 0.5> }
light_source { 100*z color rgb <0.5, 0.5, 1.0> }

// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7


Post a reply to this message

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