0
$\begingroup$

I have a shape that I'm not sure what to call. Basically, given two line segments $p$ which lives on 3d points $(a,b)$, and $q$ which lives on 3d points $(c,d)$, the shape is defined by the surface created when creating line segments from every point starting from $a$->$c$ all the way to $b$->$c$, for every point between $a$ and $b$ on the line segment $p$.

What I need is a way to take a ray defined by $origin + t * direction$ or $o + t*d$ and find the intersection if it exists on the surface.

I'm not sure what this shape is called, it is sort of like a helicoid, but it has a different equation, it isn't defined by lateral lines with respect to $p$ like a helicoid is, and twisting the line segments completely around does not produce a 3d shape like a helicoid would, it produces a plane. I can't look up what the intersection would be because of this.

here is the type of shape and intersection I'm talking about:

enter image description here

(there would be no holes in the surface, the lines have spaces to illustrate where each line exists).

I know the set up for the equation must look something like:

$$o + t*d = EquationForSurface(p,q,(o + t*d))$$

but I'm not entirely sure what the other equation is. I know its an equation that spits out a different equation of a line segment depending on the location, but I don't know how to parameterize it.

I'm thinking I can rotate the point to make $p$ a line oriented on the origin laying flat, and considering that if you move a point along $p$ half way, the resulting line segment will end up half way on $q$, I can use that to take the x position of the transformed point to directly correspond to a point on $p$, and knowing the percentage along $p$, I'll also know the point on $q$, and then it is a simple test for point line-segment intersection.

so the equation for the surface should be something like (excluding bounds checking and edge cases):

def EquationForSurface(p:linesegment, q:linesegment, point:point3d):
    #calculate the transformation matrix to orient p at 0,0 on middle to x,y plane. 
    transpx = calcorientxmat(p)
    px = transform(p, transpx)
    qx = transform(q, transpx)
    pointx = transpx * point
    px_percent = pointx.x / p.b.x + 0.5 #oriented at zero, so either side has side length
    px_start = find_point_on_segment(px, px_percent)
    qx_end = find_point_on_segment(qx, px_percent)
    intersecting_line_segment = LineSegment(px_start, qx_end)

    #orient line segment back to the origional space
    reoriented_line_segment = transform(intersecting_line_segment, inv(transpx))
    return equation_for_linesegment(reoriented_line_segment, point)

but having a hard time trying to bring this back into a parametric form I can solve for so I can figure out how to find the intersection with a ray.

$\endgroup$
1
$\begingroup$

The problem is that you over-complicate the problem. Let's start with your definition of the "surface". If you connect every point $\vec p$ on $\vec{ab}$ with every point $\vec q$ on $\vec{cd}$ you will not get a surface, but a volume (you have a tetrahedron). To see that, just connect $\vec a$ to $\vec c$ and $\vec b$ to $\vec d$.

Since you are talking about a surface, my guess that what you really want is to move a fraction $f$ of the way between $\vec a$ and $\vec b$ and connect with the point at the exact same fraction between $\vec c$ and $\vec d$. So that means $$\vec p=\vec a+(\vec b-\vec a)f\\\vec q=\vec c+(\vec d-\vec c)f$$Now write the equation connecting $\vec p$ and $\vec q$ as $$\vec i=\vec p+(\vec q-\vec p)g$$where $g$ is a parameter. Now all you need to do is to say that $\vec i$ is on the ray $\vec o+\vec v t$. I've used $\vec v$ here as not to confuse with the position vector of the $d$ point. Since you have three components, you have three equations. The unknowns are $f$, $g$, and $t$.

$\endgroup$
10
  • $\begingroup$ I'm sorry but I don't understand. The connections are not 1 to N, they are 1 to 1, I thought my picture would illustrate that, there's only one line to each point on each line segment, this is not a volume. I do not believe I have a tetrahedron (you can see in the picture there is no such tetrahedron). $\endgroup$
    – Krupip
    Aug 9 '19 at 15:50
  • $\begingroup$ Your question was not clear enough. But go past the first paragraph in my answer. Is this what you had in mind? (the first sentence in the second paragraph) $\endgroup$
    – Andrei
    Aug 9 '19 at 15:55
  • $\begingroup$ I'm reading it and its starting to look like this is still what I want, but what isn't clear about my question? I could try clarifying it to help, but I thought at least the geometry of what I'm trying to intersect was clear, especially from the picture. $\endgroup$
    – Krupip
    Aug 9 '19 at 15:56
  • $\begingroup$ You said that since I have three components I have three equations, but I don't really see that, once you substitute the equations for p and q in, you only have one equation right? $\endgroup$
    – Krupip
    Aug 9 '19 at 16:58
  • $\begingroup$ But $\vec p=(p_x,p_y,p_z)$ and so on. You have three components. You can write the one vector equation as three scalar equations. $\endgroup$
    – Andrei
    Aug 9 '19 at 17:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.