Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Login

    3x3 matrix

    PYTHON Development
    0
    5
    768
    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 14/01/2015 at 04:24, xxxxxxxx wrote:

      Is there a way to do 3x3 matrix calculation like inverse mat.
      I like to use it, to calculate the intersection of a line and a plane.

      This problem is typically solved by expressing it in matrix form, and inverting it:
       \begin{bmatrix} t \\ u \\ v \end{bmatrix} = \begin{bmatrix} x_a - x_b & x_1 - x_0 & x_2 - x_0 \\ y_a - y_b & y_1 - y_0 & y_2 - y_0 \\ z_a - z_b & z_1 - z_0 & z_2 - z_0 \end{bmatrix}^{-1} \begin{bmatrix} x_a - x_0 \\ y_a - y_0 \\ z_a - z_0 \end{bmatrix}.

      -Pim

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

        On 14/01/2015 at 06:32, xxxxxxxx wrote:

        Hello,

        you can invert a Matrix[URL-REMOVED] with "\__invert\_\_()[URL-REMOVED]" or the Python "invert" operator "~" .

          
        inverseMatrix = ~worldSpaceCoords  
        

        You may also take a look at the GeRayCollider [URL-REMOVED]that can be used to calculate the intersections of a ray and a poly object.

        best wishes,
        Sebastian


        [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

          On 14/01/2015 at 08:08, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          Hello,

          you can invert a Matrix[URL-REMOVED] with "\__invert\_\_()[URL-REMOVED]" or the Python "invert" operator "~" .

           
          inverseMatrix = ~worldSpaceCoords  
          

          You may also take a look at the GeRayCollider [URL-REMOVED]that can be used to calculate the intersections of a ray and a poly object.

          best wishes,
          Sebastian

          Yes, but that is all for a cinema 4d matrix and that is a 4x4 matrix, not a 3x3 matrix.
          I want to use a 3x3 matrix.

          I know I can use the GeRayCollider, but I want to do it myself.

          So, how to do 3x3 matrix calculations in cinema 4d?

          -Pim


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

            On 15/01/2015 at 06:55, xxxxxxxx wrote:

            Hello,

            if you cannot use the existing classes and functions of the API you have to solve this problem like any other problem by implementing your own solution or using a existing library.

            If you want to calculate the intersection of a ray and a triangle you do not necessarily need to handle Matrix objects. There are other algorithms like this one.

            Best wishes,
            Sebastian

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

              On 15/01/2015 at 07:25, xxxxxxxx wrote:

              Thanks, i will make my own 3x3 matrix calculation.
              Thanks for the link.

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