POV-Ray : Newsgroups : povray.advanced-users : can anyone suggest a better solution for my problem? Server Time
25 Dec 2024 01:08:51 EST (-0500)
  can anyone suggest a better solution for my problem? (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Oded
Subject: can anyone suggest a better solution for my problem?
Date: 27 Jun 2000 15:56:36
Message: <395906f4@news.povray.org>
This is more of of a mathematical problem than a practical one:
can any one think of a better way to create the following object type:
I was thinking, while trying to convert a dodchahedron to a 3d star, of an
object that will give the user higher control of defining 'in' and 'out' in
CSG objects. in pov-ray you can only define intersections, inverses and
unions.
I was thinking of more complicated rules, eg:
    a point A is "inside" function (a1....a12) if it is         inside 11
out of 12 objects.
what i needed to do for that was to define a union of 12 intersections of 6
objects which was was quite dirty (mathematically speaking)
eventually i ended up writing a c program to raytrace these objects defined
soly by the 12 objects.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: can anyone suggest a better solution for my problem?
Date: 27 Jun 2000 18:23:41
Message: <395928E6.F377C234@online.no>
Oded wrote:

> This is more of of a mathematical problem than a practical one:
> can any one think of a better way to create the following object type:
> I was thinking, while trying to convert a dodchahedron to a 3d star, of an
> object that will give the user higher control of defining 'in' and 'out' in
> CSG objects. in pov-ray you can only define intersections, inverses and
> unions.
> I was thinking of more complicated rules, eg:
>     a point A is "inside" function (a1....a12) if it is         inside 11
> out of 12 objects.
> what i needed to do for that was to define a union of 12 intersections of 6
> objects which was was quite dirty (mathematically speaking)
> eventually i ended up writing a c program to raytrace these objects defined
> soly by the 12 objects.

I don't think I understand your problem.
Please try to explain more.

What is a1 ... a12 ?

Are your 6 objects each passing through a pair of opposite
"facets" in the dodecahedron ?

And don't you mean union of 15 intersections of 6 objects ?

1 & 2, 1 & 3, 1 & 4, 1 & 5, 1 & 6
2 & 3, 2 & 4, 2 & 5, 2 & 6
3 & 4, 3 & 5, 3 & 6
4 & 5, 4 & 6
5 & 6

I'm going off-line for a couple of days now so maybe someone
else can answer your questions if you give more information.


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: can anyone suggest a better solution for my problem?
Date: 27 Jun 2000 18:54:12
Message: <39593007.12993FFB@online.no>
Tor Olav Kristensen wrote:

> Oded wrote:
> > ...
> > what i needed to do for that was to define a union of 12 intersections of 6
> > objects which was was quite dirty (mathematically speaking)
> ...
> And don't you mean union of 15 intersections of 6 objects ?
> ...

I forgot that there are many ways to combine (or permutate ?)
6 objects.

Here's another one:

3 & 4 & 5 & 6
2 & 4 & 5 & 6
2 & 3 & 5 & 6
2 & 3 & 4 & 6
2 & 3 & 4 & 5
1 & 4 & 5 & 6
1 & 3 & 5 & 6
1 & 3 & 4 & 6
1 & 3 & 4 & 5
1 & 2 & 5 & 6
1 & 2 & 4 & 6
1 & 2 & 4 & 5
1 & 2 & 3 & 6
1 & 2 & 3 & 5
1 & 2 & 3 & 4

How are your combinations for the intersections ?

Anyway I have a feeling that your problem (even
if I don't understand what it is :-) could easily be
solved by a macro with some loops that does
all the CSG.


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


Post a reply to this message

From: Mike Williams
Subject: Re: can anyone suggest a better solution for my problem?
Date: 28 Jun 2000 13:04:09
Message: <0o0G3AAO4aW5EwJN@econym.demon.co.uk>
Wasn't it Oded who wrote:
>This is more of of a mathematical problem than a practical one:
>can any one think of a better way to create the following object type:
>I was thinking, while trying to convert a dodchahedron to a 3d star, of an
>object that will give the user higher control of defining 'in' and 'out' in
>CSG objects. in pov-ray you can only define intersections, inverses and
>unions.
>I was thinking of more complicated rules, eg:
>    a point A is "inside" function (a1....a12) if it is         inside 11
>out of 12 objects.
>what i needed to do for that was to define a union of 12 intersections of 6
>objects which was was quite dirty (mathematically speaking)
>eventually i ended up writing a c program to raytrace these objects defined
>soly by the 12 objects.

Here's a method using MegaPov. 

Use the "if" isosurface operator 12 times and set the threshold to 1.5.

First of all you need to express each of your objects a1 to a12 as
isosurface functions. In the case of a stellated dodecahedron your
objects are planes, so that's not too hard. It helps if you ensure that
the point <0,0,0> is always on the "inside" of your objects, i.e.
a1(0,0,0)<0. E.g. for the two horizontal planes "y-1=0" and "y+1=0" use
functions  "y-1" and "-y-1"; the second plane is inverted so that
<0,0,0> is on the inside. 

The expression "if (a1, 1, 0)" returns the value 1 when a1>0 and returns
0 when a1<0. I.e. it returns 1 for points outside the a1 object and
returns 0 for points that are inside.

If we add together several "if"s, like 
 "function {if(a1,1,0) + if(a2,1,0) + ... + if(a12,1,0)}"
we get the number of objects which the point is outside. Set the
Threshold to 1.5 and you get the set of points which are outside at
least 1 but less than 2 of the objects. (If you set the threshold to an
integer value then there's a volume of points which satisfy the function
and you get slightly different results.)

Use "method 1". "method 2" gives awful results because the max_gradient
needs to be set to infinity. "method 2 eval" gives good results but
takes a very long time because it evaluates the max_gradient to have a
very high value.

A slight problem with this method is that some parts of the object seem
to be erroneously unlit. I guess it's getting confused about which side
of the surface is the interior.


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Oded
Subject: I guess there is no general solution.....
Date: 29 Jun 2000 16:24:55
Message: <395bb097@news.povray.org>
It actually can be easily solved, but still is problamatic, i'll detail:
i was talking about a 12 facet polyhedra ( may an octahedron???)
any way i have 12 symetric planes for which i need to find an object which
consists of all the points that lay inside any 11 of the 12 planes, so
orginally th problem was solved by:
union {
intersect(a1.....a11)
intersect(a1.......a10,a12)
etc.....
intersect(a2.............a12)
}
but i simplyfied it to :
union {
    intersect ( 5 specific planes); #1
    intersect ( 5 other specific planes); #2
    etc...
    intersect ( 5 other specific planes); #11
    intersect ( 5 other specific planes);#12
}
it still is ugly, since i only have 12 planes, redifining each one 5 times
is heavy on the parser and the renderer, the point is pov-ray does not
include complex-csg objects, problems more complex than mine are not
solvable in such a simple way, 9 out of 12 planes would be very big (9 over
12 = 220 objects).
Coding such a csg object is not much diiferent than an intersection or a
union.
about the macro, it just makes the code look better, the parser still does
the same work...
any way, thank you for your reply..
feel free to reply furthur more
 Oded

Tor Olav Kristensen <tto### [at] onlineno> wrote in message
news:39593007.12993FFB@online.no...
>
> Tor Olav Kristensen wrote:
>
> > Oded wrote:
> > > ...
> > > what i needed to do for that was to define a union of 12 intersections
of 6
> > > objects which was was quite dirty (mathematically speaking)
> > ...
> > And don't you mean union of 15 intersections of 6 objects ?
> > ...
>
> I forgot that there are many ways to combine (or permutate ?)
> 6 objects.
>
> Here's another one:
>
> 3 & 4 & 5 & 6
> 2 & 4 & 5 & 6
> 2 & 3 & 5 & 6
> 2 & 3 & 4 & 6
> 2 & 3 & 4 & 5
> 1 & 4 & 5 & 6
> 1 & 3 & 5 & 6
> 1 & 3 & 4 & 6
> 1 & 3 & 4 & 5
> 1 & 2 & 5 & 6
> 1 & 2 & 4 & 6
> 1 & 2 & 4 & 5
> 1 & 2 & 3 & 6
> 1 & 2 & 3 & 5
> 1 & 2 & 3 & 4
>
> How are your combinations for the intersections ?
>
> Anyway I have a feeling that your problem (even
> if I don't understand what it is :-) could easily be
> solved by a macro with some loops that does
> all the CSG.
>
>
> Tor Olav
> --
> mailto:tor### [at] hotmailcom
> http://www.crosswinds.net/~tok/tokrays.html
>
>


Post a reply to this message

From: Oded
Subject: Re: can anyone suggest a better solution for my problem?
Date: 29 Jun 2000 16:41:11
Message: <395bb467@news.povray.org>
Thank you very much
didnt think of the if function and isosurfaces
its exactly what i need...

Mike Williams <mik### [at] nospamplease> wrote in message
news:0o0### [at] econymdemoncouk...
> Wasn't it Oded who wrote:
> >This is more of of a mathematical problem than a practical one:
> >can any one think of a better way to create the following object type:
> >I was thinking, while trying to convert a dodchahedron to a 3d star, of
an
> >object that will give the user higher control of defining 'in' and 'out'
in
> >CSG objects. in pov-ray you can only define intersections, inverses and
> >unions.
> >I was thinking of more complicated rules, eg:
> >    a point A is "inside" function (a1....a12) if it is         inside 11
> >out of 12 objects.
> >what i needed to do for that was to define a union of 12 intersections of
6
> >objects which was was quite dirty (mathematically speaking)
> >eventually i ended up writing a c program to raytrace these objects
defined
> >soly by the 12 objects.
>
> Here's a method using MegaPov.
>
> Use the "if" isosurface operator 12 times and set the threshold to 1.5.
>
> First of all you need to express each of your objects a1 to a12 as
> isosurface functions. In the case of a stellated dodecahedron your
> objects are planes, so that's not too hard. It helps if you ensure that
> the point <0,0,0> is always on the "inside" of your objects, i.e.
> a1(0,0,0)<0. E.g. for the two horizontal planes "y-1=0" and "y+1=0" use
> functions  "y-1" and "-y-1"; the second plane is inverted so that
> <0,0,0> is on the inside.
>
> The expression "if (a1, 1, 0)" returns the value 1 when a1>0 and returns
> 0 when a1<0. I.e. it returns 1 for points outside the a1 object and
> returns 0 for points that are inside.
>
> If we add together several "if"s, like
>  "function {if(a1,1,0) + if(a2,1,0) + ... + if(a12,1,0)}"
> we get the number of objects which the point is outside. Set the
> Threshold to 1.5 and you get the set of points which are outside at
> least 1 but less than 2 of the objects. (If you set the threshold to an
> integer value then there's a volume of points which satisfy the function
> and you get slightly different results.)
>
> Use "method 1". "method 2" gives awful results because the max_gradient
> needs to be set to infinity. "method 2 eval" gives good results but
> takes a very long time because it evaluates the max_gradient to have a
> very high value.
>
> A slight problem with this method is that some parts of the object seem
> to be erroneously unlit. I guess it's getting confused about which side
> of the surface is the interior.
>
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: Oded
Subject: Re: can anyone suggest a better solution for my problem?
Date: 29 Jun 2000 17:46:53
Message: <395bc3cd@news.povray.org>
the if function works, but my object seems flat, i believe it is the problem
you have mentioned...
 have any solution, cause this way all of the object seems to share the same
normal...?
Mike Williams <mik### [at] nospamplease> wrote in message
news:0o0### [at] econymdemoncouk...
> Wasn't it Oded who wrote:
> >This is more of of a mathematical problem than a practical one:
> >can any one think of a better way to create the following object type:
> >I was thinking, while trying to convert a dodchahedron to a 3d star, of
an
> >object that will give the user higher control of defining 'in' and 'out'
in
> >CSG objects. in pov-ray you can only define intersections, inverses and
> >unions.
> >I was thinking of more complicated rules, eg:
> >    a point A is "inside" function (a1....a12) if it is         inside 11
> >out of 12 objects.
> >what i needed to do for that was to define a union of 12 intersections of
6
> >objects which was was quite dirty (mathematically speaking)
> >eventually i ended up writing a c program to raytrace these objects
defined
> >soly by the 12 objects.
>
> Here's a method using MegaPov.
>
> Use the "if" isosurface operator 12 times and set the threshold to 1.5.
>
> First of all you need to express each of your objects a1 to a12 as
> isosurface functions. In the case of a stellated dodecahedron your
> objects are planes, so that's not too hard. It helps if you ensure that
> the point <0,0,0> is always on the "inside" of your objects, i.e.
> a1(0,0,0)<0. E.g. for the two horizontal planes "y-1=0" and "y+1=0" use
> functions  "y-1" and "-y-1"; the second plane is inverted so that
> <0,0,0> is on the inside.
>
> The expression "if (a1, 1, 0)" returns the value 1 when a1>0 and returns
> 0 when a1<0. I.e. it returns 1 for points outside the a1 object and
> returns 0 for points that are inside.
>
> If we add together several "if"s, like
>  "function {if(a1,1,0) + if(a2,1,0) + ... + if(a12,1,0)}"
> we get the number of objects which the point is outside. Set the
> Threshold to 1.5 and you get the set of points which are outside at
> least 1 but less than 2 of the objects. (If you set the threshold to an
> integer value then there's a volume of points which satisfy the function
> and you get slightly different results.)
>
> Use "method 1". "method 2" gives awful results because the max_gradient
> needs to be set to infinity. "method 2 eval" gives good results but
> takes a very long time because it evaluates the max_gradient to have a
> very high value.
>
> A slight problem with this method is that some parts of the object seem
> to be erroneously unlit. I guess it's getting confused about which side
> of the surface is the interior.
>
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: J  Grimbert
Subject: Re: can anyone suggest a better solution for my problem?
Date: 7 Jul 2000 05:12:59
Message: <39659FDA.EBF9F4C8@atos-group.com>


> the if function works, but my object seems flat, i believe it is the problem
> you have mentioned...
>  have any solution, cause this way all of the object seems to share the same
> normal...?

Well, I started thinking about a new CSG construct after your first message.
Please have a look in p.b.i for some examples, subject is Kepler.

My solution introduce a new object in povray (Yet another patch... sorry!)
I do not know if it is acceptable for your original problem.


>
> Mike Williams <mik### [at] nospamplease> wrote in message
> news:0o0### [at] econymdemoncouk...
> > Wasn't it Oded who wrote:
> > >This is more of of a mathematical problem than a practical one:
> > >can any one think of a better way to create the following object type:
> > >I was thinking, while trying to convert a dodchahedron to a 3d star, of
> an
> > >object that will give the user higher control of defining 'in' and 'out'
> in
> > >CSG objects. in pov-ray you can only define intersections, inverses and
> > >unions.
> > >I was thinking of more complicated rules, eg:
> > >    a point A is "inside" function (a1....a12) if it is         inside 11
> > >out of 12 objects.
> > >what i needed to do for that was to define a union of 12 intersections of
> 6
> > >objects which was was quite dirty (mathematically speaking)
> > >eventually i ended up writing a c program to raytrace these objects
> defined
> > >soly by the 12 objects.
> >

[isosurface solution removed from this message]

>
> >
> > --
> > Mike Williams
> > Gentleman of Leisure


Post a reply to this message

From: Oded
Subject: Re: can anyone suggest a better solution for my problem?
Date: 7 Jul 2000 11:50:23
Message: <3965fc3f@news.povray.org>
appreciate your reply, and please excuse my ignurance, but what is p.b.i?
J. Grimbert <jgr### [at] atos-groupcom> wrote in message
news:39659FDA.EBF9F4C8@atos-group.com...
>
>

>
> > the if function works, but my object seems flat, i believe it is the
problem
> > you have mentioned...
> >  have any solution, cause this way all of the object seems to share the
same
> > normal...?
>
> Well, I started thinking about a new CSG construct after your first
message.
> Please have a look in p.b.i for some examples, subject is Kepler.
>
> My solution introduce a new object in povray (Yet another patch... sorry!)
> I do not know if it is acceptable for your original problem.
>
>
> >
> > Mike Williams <mik### [at] nospamplease> wrote in message
> > news:0o0### [at] econymdemoncouk...
> > > Wasn't it Oded who wrote:
> > > >This is more of of a mathematical problem than a practical one:
> > > >can any one think of a better way to create the following object
type:
> > > >I was thinking, while trying to convert a dodchahedron to a 3d star,
of
> > an
> > > >object that will give the user higher control of defining 'in' and
'out'
> > in
> > > >CSG objects. in pov-ray you can only define intersections, inverses
and
> > > >unions.
> > > >I was thinking of more complicated rules, eg:
> > > >    a point A is "inside" function (a1....a12) if it is
inside 11
> > > >out of 12 objects.
> > > >what i needed to do for that was to define a union of 12
intersections of
> > 6
> > > >objects which was was quite dirty (mathematically speaking)
> > > >eventually i ended up writing a c program to raytrace these objects
> > defined
> > > >soly by the 12 objects.
> > >
>
> [isosurface solution removed from this message]
>
> >
> > >
> > > --
> > > Mike Williams
> > > Gentleman of Leisure
>


Post a reply to this message

From: Chris Huff
Subject: Re: can anyone suggest a better solution for my problem?
Date: 7 Jul 2000 12:10:28
Message: <chrishuff-7FBECC.11104307072000@news.povray.org>
In article <3965fc3f@news.povray.org>, "Oded" <est### [at] isdnnetil> 
wrote:

> appreciate your reply, and please excuse my ignurance, but what is p.b.i?

povray.binaries.images

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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