Thanks so much for characterizing the problem properly in this manner
- that's exactly right. I just did a search for torus-line
intersections and found some solutions:
http://tog.acm.org/GraphicsGems/gemsii/intersect/inttor.c
On Sep 26, 9:11 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> Maybe I don't understand the question exactly.
>
> Consider the circle x^2+y^2=1, z=0, and the set S of all points
> at a small distance d, say d near 1/100, from this circle. I think
> that is a torus, isn't it?
> You want a symbolic equation (ie, a function of d) for the points in
> the intersection
> of this torus with a line?
>
> Just guessing, I would imagine this could depend on d in a complicated way,
> as when d is small you could have 0, 1, 2, 3, or 4 solutions, but when d is
> large, it seems to me you could have 0, 1 or 2 solutions.
> Maybe it's not so simple?
>
> On Fri, Sep 26, 2008 at 11:46 PM, Eugene Jhong <[EMAIL PROTECTED]> wrote:
>
> > Newbie to sage - trying to find a point on a line in 3D that is a
> > specified distance from a circle (the line is not coplanar with the
> > circle). Here's what I've inputed into sage:
>
> > var("line_dir_x line_dir_y line_dir_z line_p_x line_p_y line_p_z
> > cent_x cent_y cent_z norm_x norm_y norm_z u radius length")
> > line_dir = vector([line_dir_x, line_dir_y, line_dir_z]) # direction
> > of line
> > line_p = vector([line_p_x, line_p_y, line_p_z]) # point on
> > the line
> > cent = vector([cent_x, cent_y, cent_z]) # center
> > of circle
> > norm = vector([norm_x, norm_y, norm_z]) # normal to
> > plane of circle
> > p = line_p + u * line_dir
> > diff0 = p - cent
> > dist = diff0.dot_product(norm)
> > diff1 = diff0 - dist * norm
> > sqr_len = diff1.dot_product(diff1)
> > closest_point1 = cent + (radius/sqrt(sqr_len))*diff1
> > diff2 = p - closest_point1
> > eq = length**Integer(2) == diff2.dot_product(diff2)
> > solve([eq], u)
>
> > Here's what eq looks like:
>
> > rleg_len^2 == (-radius*(-norm_z*(norm_z*(line_dir_z*u + line_p_z -
> > cent_z) + norm_y*(line_dir_y*u + line_p_y - cent_y) +
> > norm_x*(line_dir_x*u + line_p_x - cent_x)) + line_dir_z*u + line_p_z -
> > cent_z)/sqrt((-norm_z*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_z*u + line_p_z - cent_z)^2 + (-
> > norm_y*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_y*u + line_p_y - cent_y)^2 + (-
> > norm_x*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_x*u + line_p_x - cent_x)^2) +
> > line_dir_z*u + line_p_z - cent_z)^2 + (-radius*(-
> > norm_y*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_y*u + line_p_y - cent_y)/sqrt((-
> > norm_z*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_z*u + line_p_z - cent_z)^2 + (-
> > norm_y*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_y*u + line_p_y - cent_y)^2 + (-
> > norm_x*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_x*u + line_p_x - cent_x)^2) +
> > line_dir_y*u + line_p_y - cent_y)^2 + (-radius*(-
> > norm_x*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_x*u + line_p_x - cent_x)/sqrt((-
> > norm_z*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_z*u + line_p_z - cent_z)^2 + (-
> > norm_y*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_y*u + line_p_y - cent_y)^2 + (-
> > norm_x*(norm_z*(line_dir_z*u + line_p_z - cent_z) +
> > norm_y*(line_dir_y*u + line_p_y - cent_y) + norm_x*(line_dir_x*u +
> > line_p_x - cent_x)) + line_dir_x*u + line_p_x - cent_x)^2) +
> > line_dir_x*u + line_p_x - cent_x)^2
>
> > I try to do the solve but it doesn't seem to terminate after several
> > hours. Just looking for any pointers about finding an analytical
> > solution to this seemingly simple problem.
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~---