bd->Circle2D in tag question

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

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?

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.

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

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