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

    Example of using BaseDraw::DrawSphere()

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 404 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 21/01/2008 at 22:17, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R9-R10 
      Platform:   Windows  ; Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      I'd like to draw some pretty spheres into the display. Particularly, they should be spheres that are translated, rotated, and non-uniformly scaled (ellipsoidal) globally but react locally with respect to a particular object. In the docs it says, and I quote:

      Note: The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

      I imagine that SetMatrix_Matrix() is called for to do some of the transformation work here. It is unclear whether scaling and translation will be imparted here or must be imparted via the DrawSphere() arguments. There is much to be desired in the gaping swaths of areas not covered by the SDK examples - only ONE use of ALL of the new draw functions in BaseDraw() and it is poor and useless.

      Mind providing an example of how to use these methods?

      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/01/2008 at 23:36, xxxxxxxx wrote:

        I'll provide my own example. 🙂

        Vector t = bc- >GetVector(IPP_JE_JT2SFZITRANS);
        Vector s = bc->GetVector(IPP_JE_JT2SFZISCALE);
        Vector r = ToRad(bc->GetVector(IPP_JE_JT2SFZIROT));
        Matrix     mg = emg * (MatrixMove(t) * MatrixRotZ(r.z) * MatrixRotX(r.x) * MatrixRotY(r.y) * MatrixScale(s));
        bd->SetTransparency(100L);
        bd->SetMatrix_Matrix(NULL, mg);
        bd->DrawSphere(Vector(0.0f), Vector(1.0f)*bc->GetReal(IPP_SCALING), Vector(0.0f, 1.0f, 0.0f), 0L);

        So, basically, for DrawSphere() you want to set the off vector to (0,0,0), the size vector is a literal size in x,y,z (much better to scale in the matrix), color is simple enough, set the flags to 0L (?).

        For the matrix, as noted, make it a global matrix and set the op to NULL as it is most likely unnecessary. Again, no idea what purpose.

        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 22/01/2008 at 01:29, xxxxxxxx wrote:

          Quote: _For the matrix, as noted, make it a global matrix and set the op to NULL as it is most likely unnecessary. Again, no idea what purpose.
          >
          > * * *
          _


          I am trying to get an example and a better description from the developers because, to be honest, I don't know how to use them either.

          cheers,
          Matthias

          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 22/01/2008 at 02:44, xxxxxxxx wrote:

            The off vector parameter in DrawSphere() is local space. The matrix mg in SetMatrix_Matrix() multiplied vy this vector thransforms it into global space.

            SetMatrix_Screen transform the vector into screen space and SetMatrix_Camera() into camera space.

            An example for SetMatrix_Screen() is for instance the little koordinate axis in the left button corner of the viewport.

            hope this helps

            cheers,
            Matthias

            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 22/01/2008 at 04:28, xxxxxxxx wrote:

              So, one use the off vector as a sort of alternate 'starting point'?

              My only problem is transparency. SetTransparency() only affects DrawSphere() in two ways: 0L = solid, 1L or greater = the same transparency. Negative values were interesting but not useful. 🙂 None of the SetDrawParam() settings were interesting.

              At least now I have my spheres where they want me!

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