Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Check if Polygon is flat on a Plane

    PYTHON Development
    0
    3
    633
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      On 28/06/2018 at 14:14, xxxxxxxx wrote:

      I want to check if a Polygon is flat and 100% on a Plane that is defined by another Objects XY-Axis.
      How can I do that? I am stuck here.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 28/06/2018 at 23:01, xxxxxxxx wrote:

        Not sure if this is the most technically and/or mathematically correct solution, but I would check each polygon's vertex normal (=cross product of the vertex with next and previous vertex). If all normals are equal then I would assume the polygon to be flat.
        Additionally, when all these normals are equal to the Z axis (= cross product of X and Y axis) of your reference object, then I would assume the polygon AND flat AND 100% on the XY plane of that object.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 29/06/2018 at 03:24, xxxxxxxx wrote:

          Hi Holgar, thanks for writing us.

          With regard to your question, and following C4DS hints, I recommend, given the four points arranged in such a fashion:
          A---B
          | \   |
          |  \  |
          D---C
          and that to run the following steps:

          1. check that the dot product between vectorAB and vectorZ is 0
          2. check that the dot product between vectorBC and vectorZ is 0
          3. check that the dot product between vectorAD and vectorZ is 0
          4. check that the Z-value of point A matches the Z-value of your XY-aligned plane

          Hope these few hints can help you to sort it out.

          Cheers, Riccardo

          1 Reply Last reply Reply Quote 0
          • First post
            Last post