POV-Ray : Newsgroups : povray.binaries.images : Playing with CSG (44 KB) Server Time
27 Apr 2024 07:00:55 EDT (-0400)
  Playing with CSG (44 KB) (Message 1 to 9 of 9)  
From: Tor Olav Kristensen
Subject: Playing with CSG (44 KB)
Date: 15 Apr 2000 20:23:10
Message: <38F90794.CA6221FD@hotmail.com>
When one look closely at the real 
world, one seldom find sharp edges.

Therefore I'm working on a macro 
these days for making smooth 
transitions from the different 
parts in (some) Constructive 
Solid Geometry -objects.

This is an object I created with 
the help of this macro.

Comments are wery welcome.

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message


Attachments:
Download 'ttouch01.jpg' (44 KB)

Preview of image 'ttouch01.jpg'
ttouch01.jpg


 

From: Xplo Eristotle
Subject: Re: Playing with CSG (44 KB)
Date: 15 Apr 2000 20:51:58
Message: <38F90FFA.46E698DD@unforgettable.com>
Tor Olav Kristensen wrote:
> 
> When one look closely at the real
> world, one seldom find sharp edges.
> 
> Therefore I'm working on a macro
> these days for making smooth
> transitions from the different
> parts in (some) Constructive
> Solid Geometry -objects.
> 
> This is an object I created with
> the help of this macro.
> 
> Comments are wery welcome.

Neat. Looks a bit balloony, though, and I can't help wondering how
texturing would work with this.

On an completely different note, the rounded-off parts where the spokes
meet the outer wheel REALLY remind me of welds.. though, of course,
they're far too smooth.

-- 
Xplo Eristotle
http://start.at/xplosion/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Playing with CSG (44 KB)
Date: 15 Apr 2000 21:07:19
Message: <38F911EE.A010E5@hotmail.com>
Xplo Eristotle wrote:
> Neat. 

Thank you.

> Looks a bit balloony, though, 

Hmmm... Maybe I overdid this a little bit.
(I think some of the radiuses are to small and some are to big.)

> and I can't help wondering how
> texturing would work with this.

Any suggestions?

> On an completely different note, the rounded-off parts where the spokes
> meet the outer wheel REALLY remind me of welds.. though, of course,
> they're far too smooth.

                            :)

One of the things that have inspired me to start this work 
is weldings on several tubes around in the city where I live.

And I agree with you: It really is to smooth. 

But again if one look closely at welds they are smooth in 
their own way! (I find them difficult to model accurately.)

-- 
Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Xplo Eristotle
Subject: Re: Playing with CSG (44 KB)
Date: 16 Apr 2000 04:36:01
Message: <38F97CBF.652E1BC2@unforgettable.com>
Tor Olav Kristensen wrote:
> 
> Xplo Eristotle wrote:
> 
> > and I can't help wondering how
> > texturing would work with this.
> 
> Any suggestions?

I wouldn't know where to begin.

> > On an completely different note, the rounded-off parts where the spokes
> > meet the outer wheel REALLY remind me of welds.. though, of course,
> > they're far too smooth.
> 
>                             :)
> 
> One of the things that have inspired me to start this work
> is weldings on several tubes around in the city where I live.
> 
> And I agree with you: It really is to smooth.
> 
> But again if one look closely at welds they are smooth in
> their own way! (I find them difficult to model accurately.)

True.. I've done a little welding and I don't know how I'd model that either.

-- 
Xplo Eristotle
http://start.at/xplosion/


Post a reply to this message

From: David Wilkinson
Subject: Re: Playing with CSG (44 KB)
Date: 16 Apr 2000 11:09:39
Message: <4qkjfsso5mc6qjvjq8i88sdah6pnpk08qt@4ax.com>
On Sun, 16 Apr 2000 02:21:41 +0200, Tor Olav Kristensen <tor### [at] hotmailcom>
wrote:

>
>When one look closely at the real 
>world, one seldom find sharp edges.
>
>Therefore I'm working on a macro 
>these days for making smooth 
>transitions from the different 
>parts in (some) Constructive 
>Solid Geometry -objects.
>
This is very impressive.  The creation of internal fillet radii and rounding of
external sharp edges is a real problem when trying to model real world objects
with CSG.
There are, however,  a very large number of combinations of different objects
possible in creating a composite CSG object. Does your macro attack the general
problem? Or, if not,  what cases does it apply to?
(Whatever the answer your macro/macros will be a welcome addition to the CSG
toolbox!)
David


dav### [at] hamiltonitecom
http://www.hamiltonite.com/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Playing with CSG (2 images: 46 KB and 14KB)
Date: 16 Apr 2000 21:49:58
Message: <38FA6DB9.3AD7D0E5@hotmail.com>
David Wilkinson wrote:
> 
> This is very impressive.  

Thank you!


> The creation of internal fillet radii and rounding of
> external sharp edges is a real problem when trying to model real world objects
> with CSG.
> There are, however,  a very large number of combinations of different objects
> possible in creating a composite CSG object. 

Yes, to my big frustration I am aware of the many possible 
combinations.

I have only chosen to attack a small subset of them.


> Does your macro attack the general
> problem? 

I'm afraid not...

I think that would require some pre-processing of the POV-file.

Or I would have to make macros that did some "intelligent" 
scaling of the objects before the CSG was applied. 
The macro(s) would also have to figure out if it's possible 
to do the "smoothing" with POV-Rays object primitives. 
(There are some "missing") And then at last it would have 
to select and "custom cut" the chosen object primitives before
applying them to the final CSG operations...

...And I do not have time now to even try figuring out all this.


> Or, if not,  what cases does it apply to?

To combinations of these object primitives:

Plane
Cylinder
Cone
Sphere
Torus

(But there will be restrictions on how they are aligned 
and positioned relative to each other.)

Macro so far:

Sphere meets Sphere
Torus  meets Sphere
Torus  meets Torus
(Cylinder meets Cylinder)

Next to do:

Sphere   meets Cone
Torus    meets Cone
Sphere   meets Cylinder
Torus    meets Cylinder
Cylinder meets Cone
Cone     meets Cone

And finally:

Sphere   meets Plane
Torus    meets Plane
Cylinder meets Plane
Cone     meets Plane
Plane    meets Plane

I have enclosed to images with this posting.

The first one shows how the CSG would have looked if the 
"smoothing" had not been applied (upper part of picture) 
and also the different objects that my macro returned for 
"CSG-ing" (lower part of picture).

The second picture shows in detail a cut of the right part 
of my "wheel". 

The grey area again shows how the CSG-object would have 
looked without "smoothing".

The green parts shows the parts (objects) that my macro 
returned which I chose to "add" to the final object.

And the red parts shows the parts (objects) that my macro 
returned which I chose to "subtract" from the final object.

My macro(s) needs numerical information about the two 
objects that are to be "smoothed" together (radii, centres, 
endpoints, etc.)

Then one has to select from different types of "smoothing"
("internal"/"external" fillet radii or "internal"/"external" 
rounding-radii).

In addition to returning parts that can be directly included
in the final CSG operation my macro(s) will also return some
useful numerical information about these parts.

> (Whatever the answer your macro/macros will be a welcome addition to the CSG
> toolbox!)

If there is any interest for my macros then I will release 
them so that other POV-ers can use them.

(But I think that I should finish them first. ;-)

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message


Attachments:
Download 'tt01.jpg' (46 KB) Download 'tt02.jpg' (14 KB)

Preview of image 'tt01.jpg'
tt01.jpg

Preview of image 'tt02.jpg'
tt02.jpg


 

From: Tor Olav Kristensen
Subject: Re: Playing with CSG (2 images: 46 KB and 14KB)
Date: 16 Apr 2000 21:58:17
Message: <38FA6FDA.435B6642@hotmail.com>
Tor Olav Kristensen wrote:
> 
> The second picture shows in detail a cut of the right part
> of my "wheel".
> 
> The grey area again shows how the CSG-object would have
> looked without "smoothing".
> 

Correction:

The second picture shows in detail a cut of the right part
of my "wheel".

The grey   AND RED   areas   TOGETHER   shows how 
the CSG-object would have looked without "smoothing".


Sorry. 

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Geoffrey Potvin
Subject: Re: Playing with CSG (44 KB)
Date: 16 Apr 2000 22:24:31
Message: <38fa75df@news.povray.org>
Do you have some part of this macro posted on your website etc. ...or does
it  have to be written specifically and exclusively for each CSG generated
object that your are trying to create? I don't know if you've seen it, but I
ran into such problems with my "old typewriter" model (recently posted
image) ...I cheated by leaving a lot of objects with sharp edges ...or tried
to fake it with a few bezier patches and super quadrics here and there.
Obviously, your macro would eliminate all these issues. I would be very
interested  to know how you have achieved this!

Geoffrey

Tor Olav Kristensen <tor### [at] hotmailcom> wrote in message
news:38F90794.CA6221FD@hotmail.com...
>
> When one look closely at the real
> world, one seldom find sharp edges.
>
> Therefore I'm working on a macro
> these days for making smooth
> transitions from the different
> parts in (some) Constructive
> Solid Geometry -objects.
>
> This is an object I created with
> the help of this macro.
>
> Comments are wery welcome.
>
> Tor Olav
> --
> mailto:tor### [at] hotmailcom
> http://www.crosswinds.net/~tok/tokrays.html


----------------------------------------------------------------------------
----


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Playing with CSG (44 KB)
Date: 17 Apr 2000 20:12:43
Message: <38FBA73C.2E5AD31D@online.no>
Geoffrey Potvin wrote:

> Do you have some part of this macro posted on your website etc. ...

This is "Work in progress" so I have not published it yet.

But I have enclosed the macro that I have made so far below in case you
are really interested. (All the other macros below are used by this one.)
It's named "BetweenToruses"


> or does
> it  have to be written specifically and exclusively for each CSG generated
> object that your are trying to create?

I'm not trying to make a macro that solves this problem for every possible
complex CSG operation! And I am sorry if I mislead anyone to belive this.

My macro(s) will provide the extra "material" to be taken away or added
in a CSG operation between two primitives to make the transistion smoother.

But before the macro can do this it needs some numerical information about
the chosen primitives.

I have chosen a subset of POV-Rays shape primitives.
And then I'm trying to make macros to make smooth transitions between
these primitives with cylinders and toruses.

But even with this subset I have to restrict the number of possible ways
the primitives can "meet" each other.

This is partly because there are some other primitives "missing" in POV-Ray.
(Maybe I will look into the possibility to generate these primitives with
Quartics later.)

My goal is to end up with 1, 3 or 4 macros that the end users needs to make
calls to. (Of coarse there are other macros below that the end user doesn't
"see".)


> I don't know if you've seen it, but I
> ran into such problems with my "old typewriter" model (recently posted
> image) ...I cheated by leaving a lot of objects with sharp edges ...or tried
> to fake it with a few bezier patches and super quadrics here and there.

I noticed your nice paper feed handle and the screw heads.

But as you mentioned the image is rendered without antialiasing and
therefore I found it hard to see all the other details.


> Obviously, your macro would eliminate all these issues. I would be very
> interested  to know how you have achieved this!

I'm afraid I have not eliminated all these issues!      =(

If you look into my answer to David Wilkinson 18. April you will find
my attempt to explain what I'm doing.

There are also two extra images to clarify.

Regards,

Tor Olav
---

I'm sorry that these macros are not documented.
(I'm not good at finding descriptive names for my
variables or macros either.)

And I'm afraid that this makes them rather cryptic.

The macro; BetweenToruses was the only one that I made
calls to in order to make the "wheel" picture.

// ================================================
// (C) 2000 by Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok/tokrays.html
// ================================================

#macro VectorAngles(Vector)

  <acos(vnormalize((x+z)*Vector).x)*(Vector.z < 0 ? -1 : 1),
   acos(vnormalize(Vector).y),
   0>

#end // macro VectorAngles


#macro vtilt(Thing, TVector)

  #local RotateAngles = VectorAngles(TVector);

  object {
    Thing
    rotate  degrees(RotateAngles.x)*y
    rotate -degrees(RotateAngles.y)*z
    rotate -degrees(RotateAngles.x)*y
  }

#end // macro vtilt


#macro Pythagoras(hyp, kat)

 sqrt(hyp*hyp - kat*kat)

#end // macro Pythagoras


#macro Cosinus(aa, bb, cc)

  ((aa*aa + bb*bb - cc*cc)/(2*aa*bb))

#end // macro Cosinus


#macro vCosSin(aa, bb, cc)

  #local Cos = (aa*aa + bb*bb - cc*cc)/(2*aa*bb);
  #local Sin = sqrt(1 - Cos*Cos);

  <Cos, Sin>

#end // macro vCosSin


#macro ExCircle(aa, bb, cc)

  #local vCS = vCosSin(aa, bb, cc);

  (<aa, bb*vCS.y + vCS.x/vCS.y*(vCS.x*bb - aa)>/2)

#end // macro ExCircle


#macro CirclesTouch(Type, R1, R2, R3, Dist, CirIntSct, Ctr3, TouchPt13,
TouchPt23, Ctr45, Rad45)

  #switch (Type)

    #case (1)
      #local Ra = R1 + R3;
      #local Rc = R2 + R3;
    #break // case

    #case (2)
      #local Ra = R1 - R3;
      #local Rc = R2 - R3;
    #break // case

    #case (3)
      #local Ra = R1 + R3;
      #local Rc = R2 - R3;
    #break // case

    #case (4)
      #local Ra = R1 - R3;
      #local Rc = R2 + R3;
    #break // case

    #else
      #debug "Macro CirclesTouch: Wrong Type number given."

  #end // switch Type

  #local vABC = vCosSin(Ra, Dist, Rc);
  #local vRBR = vCosSin(R1, Dist, R2);

//#local Ctr1 = <0, 0>;
  #local Ctr2 = <Dist, 0>;

  #declare Ctr3 = Ra*vABC;
  #declare CirIntSct = R1*vRBR;
  #declare TouchPt13 = R1*vABC;
  #declare TouchPt23 = Ctr2 + R2/Rc*(Ctr3 - Ctr2);

  #local sDir = ExCircle(vlength(CirIntSct - TouchPt13),
                         vlength(TouchPt23 - CirIntSct),
                         vlength(TouchPt13 - TouchPt23));
  #local MidPt = (TouchPt13 + CirIntSct)/2;
  #local vCtr = vnormalize(<vABC.y, -vABC.x > - <vRBR.y, -vRBR.x>)*sDir.y;

  #switch (Type)

    #range (1, 2)
      #declare Ctr45 = MidPt + vCtr;
    #break // range

    #range (3, 4)
      #declare Ctr45 = MidPt - vCtr;
    #break // range

    #else
      #debug "Macro CirclesTouch: Wrong Type number given."

  #end // switch Type

  #declare Rad45 = vlength(sDir);

#end // macro CirclesTouch


#macro v2D3D(v2D, vBas1, vBas2)

  (v2D.x*vBas1 + v2D.y*vBas2)

#end // macro v2D3D


#macro CSGselect(Type, MnThing1, MnThing2, MtThing, SmThing)

  intersection {

    object { MtThing }
    object { SmThing  inverse }

    #switch (Type)
      #case (1)
        object { MnThing1 inverse }
        object { MnThing2 inverse }
      #break // case

      #case (2)
        object { MnThing1 }
        object { MnThing2 }
      #break // case

      #case (3)
        object { MnThing1 inverse }
        object { MnThing2 }
      #break // case

      #case (4)
        object { MnThing1 }
        object { MnThing2 inverse }
      #break // case

      #else
        #debug "Macro CSGselect: Wrong Type number given."
    #end // switch Type

  }

#end // macro CSGselect


#macro BetweenToruses(Type, v3TCtr1, v3TCtr2,
                      R1b, R2b, R1s, R2s, R3s,
                      v3Ctr3_a, v3Ctr3_b, R3b_a, R3b_b,
                      oBetwO, oBetwI)

  #local v3Diff = v3TCtr2 - v3TCtr1; // v3Ts
  #local sTs = vlength(v3Diff); // sTs
  #local rDiff = R2b - R1b; // sD
  #local v2TT = <sTs, rDiff>;
  #local Distance = vlength(v2TT);

  #local v3Forw = vnormalize(v3Diff);

  #local v2Isect  = <0, 0>;
  #local v2Ctr3   = <0, 0>;
  #local v2Touch1 = <0, 0>;
  #local v2Touch2 = <0, 0>;
  #local v2CtrA   = <0, 0>;
  #local RadA     = 0;

  CirclesTouch(Type, R1s, R2s, R3s, Distance, v2Isect, v2Ctr3, v2Touch1,
v2Touch2, v2CtrA, RadA)

  #local v2Forw = vnormalize(v2TT);
  #local v2Side = <-v2Forw.y, v2Forw.x>;

  #declare v2Ctr3_a = v2D3D(v2Ctr3, v2Forw,  v2Side);
  #declare v2Ctr3_b = v2D3D(v2Ctr3, v2Forw, -v2Side);

  #local   v2CtrM_a = v2D3D(v2CtrA, v2Forw,  v2Side);
  #local   v2CtrM_b = v2D3D(v2CtrA, v2Forw, -v2Side);

  #local Obj1 =
  object {
    vtilt(torus { R1b, R1s }, v3Forw)
    translate v3TCtr1
  }

  #local Obj2 =
  object {
    vtilt(torus { R2b, R2s }, v3Forw)
    translate v3TCtr2
  }

  #local   v3CtrM_a = v3TCtr1 + v2D3D(v2CtrM_a, v3Forw, vNull);
  #local   v3CtrM_b = v3TCtr1 + v2D3D(v2CtrM_b, v3Forw, vNull);
  #local   RMb_a = R1b + v2CtrM_a.y;
  #local   RMb_b = R1b + v2CtrM_b.y;

  #declare v3Ctr3_a = v3TCtr1 + v2D3D(v2Ctr3_a, v3Forw,  vNull);
  #declare v3Ctr3_b = v3TCtr1 + v2D3D(v2Ctr3_b, v3Forw,  vNull);
  #declare R3b_a = R1b + v2Ctr3_a.y;
  #declare R3b_b = R1b + v2Ctr3_b.y;

  #local ObjM_a =
  object {
    vtilt(torus { RMb_a, RadA }, v3Forw)
    translate v3CtrM_a
  }

  #local Obj3_a =
  object {
    vtilt(torus { R3b_a, R3s  }, v3Forw)
    translate v3Ctr3_a
  }

  #local ObjM_b =
  object {
    vtilt(torus { RMb_b, RadA }, v3Forw)
    translate v3CtrM_b
  }

  #local Obj3_b =
  object {
    vtilt(torus { R3b_b, R3s  }, v3Forw)
    translate v3Ctr3_b
  }

  #declare oBetwO =
    CSGselect(Type, Obj1, Obj2, ObjM_a, Obj3_a)

  #declare oBetwI =
    CSGselect(Type, Obj1, Obj2, ObjM_b, Obj3_b)

#end // macro BetweenToruses


Post a reply to this message

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