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
-~----------~----~----~----~------~----~------~--~---

Reply via email to