point intersection 3Dface

Discussion in 'AutoCAD' started by Genide, Apr 16, 2004.

  1. Genide

    Genide Guest

    Given a 3dFace and a point X,Y

    How can I determine Z value of the point.

    I would
    First have to determine if the point falls within the Face and
    Secondly I would have to calculate the Z value.

    Does anyone have the algorithm for this or know where I could find it.
    I am aware that this exists in LDT and that there are 3rd Part programs.
     
    Genide, Apr 16, 2004
    #1
  2. I notice that I am able to create a warped 4-corner 3DFACE, in which the 4
    corners are not all in the same plane. Does your solution need to
    accomodate these types of 3dFACES or can it skip over them? Also, does your
    program need to accomodate 4-corner 3dFACES in general, or just triangular
    facets? It's not a big deal, it's just simpler if it's only triangles or at
    most triangles and planar quads that you are interested in.

    If you're doing planar faces, you can calculate the ABCD variables in the
    following link, and use them to find the Z given X,Y.
    You'd get this by solving for Z when sign (s) = 0. So z = -(Ax + By +
    D) / C
    http://astronomy.swin.edu.au/~pbourke/geometry/planeeq/

    To see if the X&Y are within the 3dFACE, you could adapt the function in the
    following thread.
    http://groups.google.com/groups?threadm=

    Good luck, let us know how it goes...

    James
     
    James Belshan, Apr 16, 2004
    #2
  3. Genide

    Genide Guest

    Thanks James
    Yes, both 3point and 4 point faces.

    is the following correct for finding the Z on a 3point face ?
    A=y1(z2-z3)+y2(z3-z1)+y3(z1-z2)
    B=z1(x2-x3)+z2(x3-x1)+z3(x1-x2)
    C=x1(y2-y3)+x2(y3-y1)+x3(y1-y2)
    D=-x1(y2z3-y3z2)+x2(y3z1-y1z3)+x3(y1z2-y2z1)

    Z = -(A + B +D)/C

    and how do I get the Z on a 4point face ?
     
    Genide, Apr 29, 2004
    #3
  4. I'm having a hard time finding the time to check your formulas.... I've got
    it flagged to follow up, though, so I will get to it eventually.

    As far as the 4-point face, it's more difficult because it is not
    necessarily a plane. 3 different points always form a plane, as long as
    they're not in a line, but 4 points can be warped. Then it becomes a matter
    of judgement which plane to use to calculate your Z-value. If you're not
    expecting warped 4-point faces, what you can do is put any 3 of the points
    into your 3-point formula. As a check for warping, you could use different
    combinations of points (there should be 4 possible combinations, I think),
    and see if you get same or different answers.

    James
     
    James Belshan, May 10, 2004
    #4
  5. I looked at your formulas and A,B,C all look right. D and Z, though, are
    not quite right. For D, to get rid of the negative sign in front of D, you
    need to reverse the sign on all 3 terms on the right hand side. So the
    correct formula for D is:

    D = -x1(y2z3-y3z2) - x2(y3z1-y1z3) - x3(y1z2-y2z1)

    The formula for Z needs to have in it X and Y of the point you're trying to
    find. Starting with the formula on the web, you set S=0 (for points on the
    plane, which is what we're trying to find). So:

    0 = Ax + By + Cz + D

    You know x, y, A,B,C, and D, so some algebra will get you the formula solved
    for Z. It's:

    z = -(Ax + By + D) / C

    Note that my formulas depend on the web page I referenced being correct.
    But I believe Mr. Bourke is pretty knowledgeable.

    Hope this helps,

    James
     
    James Belshan, May 14, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.