POV-Ray : Newsgroups : povray.newusers : placing objects at intersections? Server Time
27 Nov 2024 19:22:47 EST (-0500)
  placing objects at intersections? (Message 1 to 10 of 10)  
From: Dawn McKnight
Subject: placing objects at intersections?
Date: 28 Jul 2002 19:45:38
Message: <3D44821F.4C35DD5C@earthlink.net>
Is there a way to say place object a at the intersection of objects b
and c?

If there isn't, can anyone suggest how I can find the right equation for
the shape of a sphere scaled to 1.35 times longer in the y direction
than in the x?  I tried a parabola, but it came out too flat.


Post a reply to this message

From: Warp
Subject: Re: placing objects at intersections?
Date: 28 Jul 2002 21:21:29
Message: <3d449899@news.povray.org>
Dawn McKnight <gru### [at] earthlinknet> wrote:
> Is there a way to say place object a at the intersection of objects b
> and c?

  If there would be an easy way, that would be great news for collision
detection.
  Unfortunately, I don't think there is any easy solution for the general
case.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Dawn McKnight
Subject: Re: placing objects at intersections?
Date: 28 Jul 2002 23:15:10
Message: <3D44B338.9040006@mac.com>
>   Unfortunately, I don't think there is any easy solution for the general
> case.

Maybe someone can help me with my math, then.

I have a sphere scaled to <40, 54, 9.2>.  I wanted to place a row of 
holes along a parabolic surface that would match the curve of the elipse 
in the XY plane.

I came up with f(x) = 0.04909(27.5-x)^2+37.125, which produces a 
parabola that matches the x and y intercepts, but the sides are too flat.

I think if I could find a point that wasn't an intercept, I could come 
up with a better parabolic model, but I don't know how to do that, short 
of (extensive) trail and error.

Suggestions?  Anyone?


Post a reply to this message

From: Tim Nikias
Subject: Re: placing objects at intersections?
Date: 29 Jul 2002 00:39:16
Message: <3d44c6f4$1@news.povray.org>
I suppose you're using POV-Ray 3.5, so if you'd just
go ahead and look at 6.1.4.6 in the documentation,
(Vector Expressions), you'll find a vector function called
"trace".
It returns the intersection of a ray that comes from
a User-Given position, along a User-Given direction.

The correct setup of starting positions and directions
for the rays would result in what you want.

Its early morning now, so I'm not up to the math-part
of your question yet, but if you give some more specific
details, I could look at them when I'm back from work...

Regards,

Tim

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde

> Is there a way to say place object a at the intersection of objects b
> and c?
>
> If there isn't, can anyone suggest how I can find the right equation for
> the shape of a sphere scaled to 1.35 times longer in the y direction
> than in the x?  I tried a parabola, but it came out too flat.
>
>


Post a reply to this message

From: Tony LaVigne
Subject: Re: placing objects at intersections?
Date: 29 Jul 2002 01:56:01
Message: <web.3d44d8741b88da9b88d4e3910@news.povray.org>
Dawn McKnight wrote:
>>   Unfortunately, I don't think there is any easy solution for the general
>> case.
>
>Maybe someone can help me with my math, then.
>
>I have a sphere scaled to <40, 54, 9.2>.  I wanted to place a row of
>holes along a parabolic surface that would match the curve of the elipse
>in the XY plane.
>
>I came up with f(x) = 0.04909(27.5-x)^2+37.125, which produces a
>parabola that matches the x and y intercepts, but the sides are too flat.
>
>I think if I could find a point that wasn't an intercept, I could come
>up with a better parabolic model, but I don't know how to do that, short
>of (extensive) trail and error.
>
>Suggestions?  Anyone?
>


Dawn,
Where did you derive your f(x)  equation from?

Is the general equation for this sphere
1= (  (x-Xo)/40  )^2 + ( (y-Yo)/54  )^2  +( (z-Zo)/9.2 )^2   where
(Xo,Yo,Zo) is the center of the sphere?
I tested this equation against a scaled sphere you cited and it
seemed to work.

If so, and if the center of the sphere is (0,0,0) and your XY plane is at
z=0, then the equation might boil down to

y= f(x) = sqrt{ [1-(x/40)^2] / [54^2]  }

Hope this helps,
Sorry if I misinterpreted something
Tony

ton### [at] xenomechanicscom


Post a reply to this message

From:
Subject: Re: placing objects at intersections?
Date: 29 Jul 2002 02:50:08
Message: <n1p9kuocnvaph0n0hl6018dm6eqpl2qlph@4ax.com>
On Sun, 28 Jul 2002 16:45:35 -0700, Dawn McKnight <gru### [at] earthlinknet>
wrote:
> Is there a way to say place object a at the intersection of objects b
> and c?

Not ideal but can work.

#include "rand.inc"
#local A=object{...};
#local B=object{...};
#local C=object{...};
#local Generator=seed(100);
#local Intersection=intersection{object{B}object{C}};
object{ A translate VRand_In_Obj(Intersection,Generator) }

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: placing objects at intersections?
Date: 29 Jul 2002 10:17:36
Message: <chrishuff-1A4205.09103229072002@netplex.aussie.org>
In article <3D44821F.4C35DD5C@earthlink.net>,
 Dawn McKnight <gru### [at] earthlinknet> wrote:

> Is there a way to say place object a at the intersection of objects b
> and c?

There is no way to guarantee that they intersect at a single point, and 
if they did there wouldn't be a way to find that point reliably. You 
could just look for a random point inside the intersection though, as 
someone else suggested.


> If there isn't, can anyone suggest how I can find the right equation for
> the shape of a sphere scaled to 1.35 times longer in the y direction
> than in the x?  I tried a parabola, but it came out too flat.

Not a parabola, an ellipsoid. Just a scaled sphere. I'm not sure what 
you are trying to do, if you just want points on the sphere, use a 
scaled sphere with the trace() function. If you want an isosurface, just 
inversely scale the inputs to the sphere function.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

From: Dawn McKnight
Subject: Re: placing objects at intersections?
Date: 29 Jul 2002 21:19:57
Message: <3D45E9B9.2040200@mac.com>
Tony LaVigne wrote:
> Dawn,
> Where did you derive your f(x)  equation from?

Hey, Tony.

First of all, let me sy thanks for your assistance... I'm really a math 
idiot trying to make it in a big world.

My function is derived from the standard parabolic form y = a(x-h)^2 +k, 
where h, k are the x, y coordinates of the vertex.  Since I want a 
parabolic section (or an elipsoidal section) that matches the shape of 
the outer edge, without actually being at the outside edge (in this 
case, I want the x intercepts at +/- 27.5, y at 37.125), I find that the 
  coordinates of the vertex are (0, 37.125).  Plug and chug, and you get 
the equation I provided.

> Is the general equation for this sphere
> 1= (  (x-Xo)/40  )^2 + ( (y-Yo)/54  )^2  +( (z-Zo)/9.2 )^2   where
> (Xo,Yo,Zo) is the center of the sphere?

Uh... I'm not sure.  Is that right?  You're setting it equal to one? 
Why not zero?  I'm confused.

I looked at the equation for the superquadratic elipsoid, which is in 
the docs, but it doesn't look like yours, and I'm not math-knowledgeable 
enough to get from one form to the other.

> If so, and if the center of the sphere is (0,0,0) and your XY plane is at
> z=0, then the equation might boil down to

That's a reasonable aproximation, yes.

> y= f(x) = sqrt{ [1-(x/40)^2] / [54^2]  }

When I plot that on my graphing calculator, I get an elipsoid shape that 
has the right x intercepts... but the y intercept is off by a factor of 
a thousand.

I'm not clever enough to figure out how to correct it....


Post a reply to this message

From: Ed Jackson
Subject: Re: placing objects at intersections?
Date: 31 Jul 2002 10:01:12
Message: <pan.2002.07.31.14.01.10.128557.17877@iastate.edu>
On Mon, 29 Jul 2002 20:19:53 -0500, Dawn McKnight wrote:

> Tony LaVigne wrote:
>> Is the general equation for this sphere 1= (  (x-Xo)/40  )^2 + (
>> (y-Yo)/54  )^2  +( (z-Zo)/9.2 )^2   where (Xo,Yo,Zo) is the center of
>> the sphere?
> 
> Uh... I'm not sure.  Is that right?  You're setting it equal to one? Why
> not zero?  I'm confused.
> 

What Tony has done is put your values into the general equation of an
ellipsoid: ( (x-x0)/a )^2 + ( (y-y0)/b )^2 + ( (z-z0)/c )^2 = 1.
The point x0,y0,z0 is the center and a, b, and c are the semiaxes (or
"radii") in the x, y, and z directions respectively.  (This equation
isn't actually *totally* general; it doesn't take into account the
possibility of rotations.)  The fact that it's equal to one arises from
geometric considerations.

> I looked at the equation for the superquadratic elipsoid, which is in
> the docs, but it doesn't look like yours, and I'm not math-knowledgeable
> enough to get from one form to the other.
> 

The superquadric ellipsoid is a different beast.  :)

>> If so, and if the center of the sphere is (0,0,0) and your XY plane is
>> at z=0, then the equation might boil down to
> 
> That's a reasonable aproximation, yes.
> 
>> y= f(x) = sqrt{ [1-(x/40)^2] / [54^2]  }
> 
> When I plot that on my graphing calculator, I get an elipsoid shape that
> has the right x intercepts... but the y intercept is off by a factor of
> a thousand.
> 
> I'm not clever enough to figure out how to correct it....
 
This was probably a typo... I think it should be

y = f(x) = 54 * sqrt( 1 - (x^2)/(40^2) )


Good luck!

	-Ed


Post a reply to this message

From: Tony LaVigne
Subject: Re: placing objects at intersections?
Date: 31 Jul 2002 21:32:02
Message: <web.3d488ef11b88da9b88d4e3910@news.povray.org>
Dawn McKnight wrote:
>Tony LaVigne wrote:
>> Dawn,
>> Where did you derive your f(x)  equation from?
>
>Hey, Tony.
>
>First of all, let me sy thanks for your assistance... I'm really a math
>idiot trying to make it in a big world.
>
>My function is derived from the standard parabolic form y = a(x-h)^2 +k,
>where h, k are the x, y coordinates of the vertex.  Since I want a
>parabolic section (or an elipsoidal section) that matches the shape of
>the outer edge, without actually being at the outside edge (in this
>case, I want the x intercepts at +/- 27.5, y at 37.125), I find that the
>  coordinates of the vertex are (0, 37.125).  Plug and chug, and you get
>the equation I provided.
>
>> Is the general equation for this sphere
>> 1= (  (x-Xo)/40  )^2 + ( (y-Yo)/54  )^2  +( (z-Zo)/9.2 )^2   where
>> (Xo,Yo,Zo) is the center of the sphere?
>
>Uh... I'm not sure.  Is that right?  You're setting it equal to one?
>Why not zero?  I'm confused.
>
>I looked at the equation for the superquadratic elipsoid, which is in
>the docs, but it doesn't look like yours, and I'm not math-knowledgeable
>enough to get from one form to the other.
>
>> If so, and if the center of the sphere is (0,0,0) and your XY plane is at
>> z=0, then the equation might boil down to
>
>That's a reasonable aproximation, yes.
>
>> y= f(x) = sqrt{ [1-(x/40)^2] / [54^2]  }
>
>When I plot that on my graphing calculator, I get an elipsoid shape that
>has the right x intercepts... but the y intercept is off by a factor of
>a thousand.
>
>I'm not clever enough to figure out how to correct it....
>

I just realized the above was posted with the news group, below if my reply
to Dawn that night.  The way I understand it, Dawn wanted the equation of
an elipsiod that contained the points (27.5,0,0) and  (0,37.125,0) with the
center  at (0,0,0).
Thanks to Ed for  pointing out the below equation also assumes the
ellipsiod has not been rotated on any axis.


.....  My Calculus book is
at work so this is all from memory years ago.
Actually my equation from last night
1= (  (x-Xo)/40  )^2 + ( (y-Yo)/54  )^2  +( (z-Zo)/9.2 )^2

can be in the form of

1= (  (x-Xo) ^2)/a + ( (y-Yo)^2)/b  +( (z-Zo)^2)/c
assuming is symetric about the origin then Xo=0, Yo=0, Zo=0;
yeilds
1=(x^2)/a +(y^2)/b +(z^2)/c
if we are on the xy plane where z= 0 then if
1 = (x^2)/a +(y^2)/b      we call equation Alpha

with (x,y) = (27.5,0), (0,37.125)
yeilds
1= (27.5^2)/a + 0
1 =  0   +(37.125^2)/b
implies
a = 27.5^2
b = 37.125^2
 therefor
y = sqrt( )

equation alpha is rearranged into
y = sqrt(b- (x^2)*b/a)
y = f(x) = sqrt( 37.125^2(1-(x^2)/(27.5^2)    )
more accurately this is symetric about the x and y axis, so there is the
other sister equation that is negitive
y = f(x) = -sqrt( 37.125^2(1-(x^2)/(27.5^2)    )
so the generic equation is
y = f(x) = +/-sqrt( 37.125^2(1-(x^2)/(27.5^2)    )

I plotted this out and it does have the intercepts at the correct place, I
hope the curve is right for you though,

Let me know if this doesn't do it
Tony










ton### [at] xenomechanicscom


Post a reply to this message

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