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
    • Login

    bd->Circle2D in tag question

    SDK Help
    0
    5
    492
    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

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

      On 26/10/2004 at 14:41, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.206 
      Platform:      
      Language(s) :     C++  ;

      ---------
      Hi,

      I have a tag expression plugin, and this tag plugin has a parameter in the AM called radius, which specifies the size of the boundry circle the tag uses to take effect.

      I would like to draw this boundary circle so its clearly visible to the user. To do this I have come up with this

        
      Bool TagPlugin::Draw(PluginTag *tag, BaseObject *op, BaseDraw *bd, BaseDrawHelp *bh)  
      {  
           BaseContainer *data = tag->GetDataInstance();  
        
           Real rRadius = data->GetReal(IDC_RADIUS, 100.0);  
           Vector vPos = bd->WS(op->GetMg().off);  
             
           bd->Circle2D(vPos.x,vPos.y, rRadius);  
           return TRUE;  
      }  
      

      This will draw a circle in the viewport, but when zoooming in or out, the circle stays exactly the same size in the viewport because rRadius is always (100 in this example)

      How can I convert this radius variable so it correctly draws the circle the correct size no matter how much I have zoomed?

      Thanks
      Ian Gorse

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

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

        On 26/10/2004 at 15:56, xxxxxxxx wrote:

        bd->Circle3D() might be more useable. Unless you want to track editor viewports, cameras, and other esoteric information just to draw your circle the right size, doesn't this option make more sense?

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

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

          On 27/10/2004 at 02:26, xxxxxxxx wrote:

          The truth is, I don't know how bd->Circle3D() works! 😉

          I don't understand what to fill in the matrix that I have to pass to it, hence the reason why I went for the 2D method instead.

          For example, if I wanted to draw a Circle3D with a 100 radius, that faces the camera, I have no idea what I should be filling the matrix with.

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

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

            On 27/10/2004 at 02:51, xxxxxxxx wrote:

            Well I solved it by using the LookAtCamera example

              
                 BaseContainer *data = tag->GetDataInstance();  
              
                 Real rRadius = data->GetReal(IDC_RADIUS, 100.0);  
                   
                 BaseObject *oCp = bd->GetSceneCamera(bh->GetDocument());  
                 if(!oCp) oCp = bd->GetEditorCamera();  
              
                 Vector vLocal = oCp->GetMg().off * (!op->GetUpMg()) - op->GetPos();  
                 Vector vHPB = VectorToHPB(vLocal);  
              
                 Matrix m = HPBToMatrix(vHPB);  
                 m.v1*=rRadius;  
                 m.v2*=rRadius;  
                 bd->Circle3D(m);  
              
                 return TRUE;  
            

            But I still don't *really* understand what Circle3D does

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

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

              On 27/10/2004 at 08:35, xxxxxxxx wrote:

              m.v1 and m.v2 are the axis vectors - this means that they represent the orientation with respect to the World coordinate system and the radius (vector length) - just like any 2D orthonormal axes or a plane definition without the normal vector.

              m.off is the circle center with respect to the World coordinate system origin.

              Robert

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