POV-Ray : Newsgroups : povray.programming : SOLID Server Time
29 Jul 2024 00:36:28 EDT (-0400)
  SOLID (Message 1 to 5 of 5)  
From: tommaso
Subject: SOLID
Date: 18 Mar 1999 05:03:42
Message: <36f0cf7e.0@news.povray.org>
con il POVRAY

voglio disegnare un SOLIDO con 8 vertici
come fare?


NON   con la "box" (2 punti opposti) e poi con "scale"
NON   con "union" di 6 polygons


Ma solo introducendo le coordinate di 8 punti generici.



Grazie

Tommaso

Tst### [at] capoleucait


Post a reply to this message

From: Alain CULOS
Subject: Re: SOLID
Date: 21 Mar 1999 13:52:34
Message: <36F3EE6A.A4E08F60@bigfoot.com>
Sorry tommaso, I don't have the answer and I am not able to speak
proper italian.
Yet I understand some of it and I will translate your query here.



Tommaso is asking how he could define a solid - sort of - box by its 8
corners.
He does not want a box as it is not flexible enough : only 2 opposite
points + scale
He does not want the union of six polygons.

He did not say so but I guess he wants to use this for CSG, but maybe
not.

If it is for CSG, my answer is it is not possible.
If it is not for CSG my answer would be to use Bezier patches, I have
not tested completely what follows but it should really be something
very close to that (beware, you have to add a texture to that) :

#macro OneFace (a,b,c,d)
//  a = top left
//  b = top right
//  c = bottom right
//  d = bottom left

#local ad=a+(d-a)/3;
#local ab=a+(b-a)/3;
#local ba=b+(a-b)/3;
#local bc=b+(c-b)/3;
#local cb=c+(b-c)/3;
#local cd=c+(d-c)/3;
#local dc=d+(c-d)/3;
#local da=d+(a-d)/3;

#local abd=(a+b+d)/3;
#local bac=(b+a+c)/3;
#local cbd=(c+b+d)/3;
#local dac=(d+a+c)/3;

bicubic_patch
{
  type     1
  flatness 0
  u_steps  4
  v_steps  4,
  a,  ab,  ba,  b,
  ad, abd, bac, bc,
  da, dac, cbd, cb,
  d,  dc,  cd,  c
}
#end

#macro Solid (a,b,c,d,e,f,g,h)
//  a = top left front
//  b = top right front
//  c = bottom right front
//  d = bottom left front
//  e = top left back
//  f = top right back
//  g = bottom right back
//  h = bottom left back

  OneFace(a,b,c,d) // front
  OneFace(b,f,g,c) // right
  OneFace(e,f,b,a) // up
  OneFace(f,e,h,g) // back
  OneFace(e,a,d,h) // left
  OneFace(d,c,g,h) // down

#end

tommaso wrote:

> con il POVRAY
>
> voglio disegnare un SOLIDO con 8 vertici
> come fare?
>
> NON   con la "box" (2 punti opposti) e poi con "scale"
> NON   con "union" di 6 polygons
>
> Ma solo introducendo le coordinate di 8 punti generici.
>
> Grazie
>
> Tommaso
>
> Tst### [at] capoleucait

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :

To answer me, please take out the Z from my address.


Post a reply to this message

From: Alain CULOS
Subject: Re: SOLID
Date: 21 Mar 1999 13:52:37
Message: <36F40FF8.17CA94A3@bigfoot.com>
tommaso wrote:

> con il POVRAY
>
> voglio disegnare un SOLIDO con 8 vertici
> come fare?
>
> NON   con la "box" (2 punti opposti) e poi con "scale"
> NON   con "union" di 6 polygons
>
> Ma solo introducendo le coordinate di 8 punti generici.
>
> Grazie
>
> Tommaso
>
> Tst### [at] capoleucait

First, povray.programming is really for how to program stuff that make
POV, not how to use POV.
So really your question belongs to the povray.text.scene-file group.

Second, I was challenged by your question and I came up with two ways
to deal with the problem :
one keeps dead straight lines between all corners.
the second tries to make corners as if they were not deformed (right
at the corner) and the rest smoothly deformed.
You can try either my StraighSolid or my TwistedSolid below.
I have done very quick testing so there may be bugs I did not spot (I
did not really check all faces were where they should be), but it
looks OK as it is.

Be warn though that this is made up of bezier patches and they cannot
take part in CSG.

--------8<-------------
#include "colors.inc"
#include "textures.inc"

#macro OneStraightFace (a,b,c,d)
  // a = top left
  // b = top right
  // c = bottom right
  // d = bottom left

  #local ad=a+(d-a)/3;
  #local ab=a+(b-a)/3;
  #local ba=b+(a-b)/3;
  #local bc=b+(c-b)/3;
  #local cb=c+(b-c)/3;
  #local cd=c+(d-c)/3;
  #local dc=d+(c-d)/3;
  #local da=d+(a-d)/3;

  #local abd=(a+b+d)/3;
  #local bac=(b+a+c)/3;
  #local cbd=(c+b+d)/3;
  #local dac=(d+a+c)/3;

  bicubic_patch
  {
    type     1
    flatness 0
    u_steps  4
    v_steps  4,
    a,  ab,  ba,  b,
    ad, abd, bac, bc,
    da, dac, cbd, cb,
    d,  dc,  cd,  c
  }
#end

#macro StraightSolid (a,b,c,d,e,f,g,h)
  //  a = top left front
  //  b = top right front
  //  c = bottom right front
  //  d = bottom left front
  //  e = top left back
  //  f = top right back
  //  g = bottom right back
  //  h = bottom left back

  OneStraightFace(a,b,c,d) // front
  OneStraightFace(b,f,g,c) // right
  OneStraightFace(e,f,b,a) // up
  OneStraightFace(f,e,h,g) // back
  OneStraightFace(e,a,d,h) // left
  OneStraightFace(d,c,g,h) // down
#end

#macro FindRightCorner (a, b, c, d, Epsilon, af, ag, ah)
  // a = centre corner
  // b = edge's one other corner    => af in the rightened corner
  // c = edge's two other corner    => ag in the rightened corner
  // d = edge's three other corner  => ah in the rightened corner
  // Epsilon = tolerance for corner resolution

  #local ab = b - a;
  #local ac = c - a;
  #local ad = d - a;
  #local ae = (ab + ac + ad) / 3;
  #local eb = ab - ae;
  #local ec = ac - ae;
  #local ed = ad - ae;

  #local Beta  = 1;
  #local dBeta = 2*Epsilon;

  #while (dBeta > Epsilon)
    #local Beta  = Beta + dBeta * 0.5;

    #local af    = ae + Beta  * eb;
    #local Gama  = - vdot (ae, af) / vdot (ec, af);
    #local ag    = ae + Gama  * ec;
    #local Delta = - vdot (ae, ag) / vdot (ed, ag);
    #local ah    = ae + Delta * ed;
    #local nBeta = - vdot (ae, ah) / vdot (eb, ah);

    #local dBeta = nBeta - Beta;
  #end

  #local af = vnormalize (af) * vlength (ab) / 3;
  #local ag = vnormalize (ag) * vlength (ac) / 3;
  #local ah = vnormalize (ah) * vlength (ad) / 3;
#end

#macro OneTwistedFace (a,ab,ad, b,ba,bc, c,cb,cd, d,dc,da)
  // a = top left
  // b = top right
  // c = bottom right
  // d = bottom left

  #local abd=a+ab+ad;
  #local bac=b+ba+bc;
  #local cbd=c+cb+cd;
  #local dac=d+da+dc;

  bicubic_patch
  {
    type     1
    flatness 0
    u_steps  4
    v_steps  4,
    a,    a+ab, b+ba, b,
    a+ad, abd,  bac,  b+bc,
    d+da, dac,  cbd,  c+cb,
    d,    d+dc, c+cd, c
  }
#end

#macro TwistedSolid (a,b,c,d,e,f,g,h)
  //  a = top left front
  //  b = top right front
  //  c = bottom right front
  //  d = bottom left front
  //  e = top left back
  //  f = top right back
  //  g = bottom right back
  //  h = bottom left back

  #declare Epsilon = 0.0001;
  #declare null = <0,0,0>;
  #declare ab = null;  #declare ad = null;  #declare ae = null;
  #declare ba = null;  #declare bf = null;  #declare bc = null;
  #declare cd = null;  #declare cb = null;  #declare cg = null;
  #declare da = null;  #declare dc = null;  #declare dh = null;
  #declare ea = null;  #declare eh = null;  #declare ef = null;
  #declare fb = null;  #declare fe = null;  #declare fg = null;
  #declare gc = null;  #declare gf = null;  #declare gh = null;
  #declare hd = null;  #declare hg = null;  #declare he = null;

  FindRightCorner (a, b, d, e, Epsilon, ab, ad, ae)
  FindRightCorner (b, a, f, c, Epsilon, ba, bf, bc)
  FindRightCorner (c, d, b, g, Epsilon, cd, cb, cg)
  FindRightCorner (d, a, c, h, Epsilon, da, dc, dh)
  FindRightCorner (e, a, h, f, Epsilon, ea, eh, ef)
  FindRightCorner (f, b, e, g, Epsilon, fb, fe, fg)
  FindRightCorner (g, c, f, h, Epsilon, gc, gf, gh)
  FindRightCorner (h, d, g, e, Epsilon, hd, hg, he)

  OneTwistedFace (a,ab,ad, b,ba,bc, c,cb,cd, d,dc,da) // front
  OneTwistedFace (b,bf,bc, f,fb,fg, g,gf,gc, c,cg,cb) // right
  OneTwistedFace (e,ef,ea, f,fe,fb, b,bf,ba, a,ab,ae) // up
  OneTwistedFace (f,fe,fg, e,ef,eh, h,he,hg, g,gh,gf) // back
  OneTwistedFace (e,ea,eh, a,ae,ad, d,da,dh, h,hd,he) // left
  OneTwistedFace (d,dc,dh, c,cd,cg, g,gc,gh, h,hg,hd) // down
#end

camera
{
  orthographic
  location  <0, -10, 0>
  direction  y
  up         2*10*z
  right      2*10*1.25*x
}

light_source { < 20, -30,  20>  1.5*White }

union
{
  TwistedSolid
(<-3,3,-3>,<2,-2,-8>,<2,-9,-6>,<-8,-7,0>,<5,5,3>,<9,0,-3>,<7,-6,0>,<5,-2,5>)

  // StraightSolid
(<-3,3,-3>,<2,-2,-8>,<2,-9,-6>,<-8,-7,0>,<5,5,3>,<9,0,-3>,<7,-6,0>,<5,-2,5>)

  // try one or the other
  // beware, my newswriter may have wrapped the lines,
  // you may have to glue them back together.

  texture {White_Marble}
}
--------8<-------------

--
ANTI SPAM / ANTI ARROSAGE COMMERCIAL :

To answer me, please take out the Z from my address.


Post a reply to this message

From: Spider
Subject: Re: SOLID
Date: 21 Mar 1999 21:53:44
Message: <36F5AFC3.87418F43@bahnhof.se>
Intersection of planes should be the thing.



tommaso wrote:
> 
> con il POVRAY
> 
> voglio disegnare un SOLIDO con 8 vertici
> come fare?
> 
> NON   con la "box" (2 punti opposti) e poi con "scale"
> NON   con "union" di 6 polygons
> 
> Ma solo introducendo le coordinate di 8 punti generici.
> 
> Grazie
> 
> Tommaso
> 
> Tst### [at] capoleucait

-- 
//Spider
        [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
                "Marian"
        By: "Sisters Of Mercy"


Post a reply to this message

From: Steve
Subject: Re: SOLID
Date: 22 Mar 1999 09:41:52
Message: <36F65771.C6B75D42@puzzlecraft.com>
Are you asking about a general algorithm for creating polyhedra? If so,
Email me and I'll send you some info on this.

If you are wondering how to create a 6 sided solid that is not a cube,
you might start off with a cube and use scale and the matrix function to
get the final effect.

If you are asking how to convert a set of coordinates into a solid, that
sounds like a job for the bicubic patch function, or possibly one of the
spline functions in combination with some other editing function.

If you could state the problem more specifically with an example it
would help in choosing a more specific answer.

tommaso wrote:

> con il POVRAY
>
> voglio disegnare un SOLIDO con 8 vertici
> come fare?
>
> NON   con la "box" (2 punti opposti) e poi con "scale"
> NON   con "union" di 6 polygons
>
> Ma solo introducendo le coordinate di 8 punti generici.
>
> Grazie
>
> Tommaso
>
> Tst### [at] capoleucait


Post a reply to this message

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