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
    • Recent
    • Tags
    • Users
    • Register
    • Login

    How do I rotate points of object

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 432 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 11/04/2005 at 05:56, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.1 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      How do I rotate points of object. I want to rotate axis like the object tool.
      I have read [First you have to rotate the object.Then you have to rotate the points of the object back.] I can rotate the object but what is the formula to rotate the points of it. When I run the get points command
      it comes back as a point array. when I try to rotate this I get incompatible values array/object error. Does anybody know about this? and how to fix it.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 11/04/2005 at 13:30, xxxxxxxx wrote:

        Ok figured out how to center axis of object with this code. But how do I rotate axis independent of object like object tool.

        main (doc,op)
        {
        // this finds the center of the objects points.

        var doc = GetActiveDocument();// Get Active Document
        var obj = GetActiveObject(doc); // Get Active Object

        var object = doc->GetFirstObject();
        var c, ty = vector(0.0), scale = 1.0 / float(object->GetPointCount());
        for (c=0; c<object->GetPointCount(); ++c) ty += object->GetPoint(c) * scale;
        ty = object->GetMl()->GetMulP(ty);

        // get inverted matrix of object and the translation vector to new position

        var inv = object->GetMl(); inv->Invert();
        var trans = inv->GetMulV(ty - object->GetPosition());

        // move object to a new position and consider vertex positions

        object->SetPosition(ty);
        for (c=0; c<object->GetPointCount(); ++c) {
        object->SetPoint(c, object->GetPoint(c) - trans);
        }
        object->Message(MSG_UPDATE);

        // Positions of child objects

        var child = object->GetDown();
        for (; child; child = child->GetNext()) {
            child->SetPosition(child->GetPosition() - trans);
        }
        return TRUE;
        }

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 21/04/2005 at 13:41, xxxxxxxx wrote:

          Use a matrix, for example mat=HPBToMatrix(), for the transformation. Then you use do the following pseudo algorithm:

              
              
              obj->SetMl(mat*obj->GetMl());  
              mat->Invert();  
              get points  
              for (all points)  
              {  
                points[i] = mat*points[i];  
              }  
              set points
          
          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 21/04/2005 at 13:42, xxxxxxxx wrote:

            The same for child objects as for the points. For all children, do child->SetMl(mat*child->GetMl()).

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