0
$\begingroup$

I have a 3-dimensional view, where I have drawn a line $L$. I know the line direction vector $(x,y,z)$, where $L$ is also the center of a cylinder with given radius $r$.

I wish, based on the radius $r$ and direction vector $(x,y,z)$ to draw the cylinder. For that, given my working environment capabilities, I only need to calculate the points of the two disks which are the limits of the cylinder.

For that, I have the $(x_1,y_1,z_1)$, $(x_2,y_2,z_2)$ which are the coordinates of the start and the end of the cylinder center on the line $L$.

I need to take calculate all points of the disks that are orthogonal to the line L and which have their center at either $(x_1,y_1,z_1)$, or $(x_2,y_2,z_2)$, having radius $r$. Of course, everything is descrete, so 360 points (going with difference of $1^\circ$) is good enough.

1 Answers 1

1

For each of the disks you have two constraints:

point on the edge of the disk $(x_e, y_e, z_e)$ must be in the distance of $r$ of the disk origin $(x_1, y_1, z_1)$ i.e. $(x_1-x_e)^2+ (y_1-y_e)^2+ (z_1-z_e)^2 = r^2$

and also the disk must be orthogonal to the line, so, knowing that scalar product gives 0 iff the two vectors are orthogonal you get: $(x_1-x_e, y_1-y_e, z_1-z_e)\cdot(x,y,z) = (x_1-x_e)x+ (y_1-y_e)y+ (z_1-z_e)z = 0$ .

With given values of disk origin $(x_1, y_1, z_1)$ and line direction $(x, y, z)$ it becomes a simple quadratic eqation.

  • 0
    i understand the first formula, aobut the distance, and also the second one, since they're both orthogonal to each other the product must be zero. but how its a quadratic equation? i have two equations with three variables unknown at each one: $x_e,y_e,z_e$. obviously, guessing one of them wont always work, only if i hit a lucky value within the range of the parameters. so how can i get one specific point with the two equations?2012-12-11
  • 0
    if taking the orthogonal vector to $(x_1,y_1,z_1)$, which is "on" the disk. now transforming to $(R,phi,theta)$, taking R as big/small as i need with same angles, will it suffice? if not, what else do i need to do?2012-12-11
  • 0
    first equation gives you a sphere with radius $r$ around $(x_1, y_1, z_1)$, the second one gives you a plane orthogonal to $(x, y, z)$ and going through $(x_1, y_1, z_1)$. The intersection of these two constraints is the searched circle. Solve second equation for one variable, put it into first equation.2012-12-12