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

    PC specific SDK Bug?

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 453 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 20/07/2009 at 18:09, xxxxxxxx wrote:

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

      ---------
      Howdy,

      I think there is a bug in the PC version of the SDK, specifically dealing with the Len() function.

      If you use this code on the PC:

      > Bool TestCommand::Execute(BaseDocument\* doc) \> { \>      Vector a = Vector(46,46,46), b = Vector(0,0,0); \>      Real length = Len(a-b); \>       \>      if(Len(a-b) < length) GePrint("TRUE"); \>       \>      return TRUE; \> }

      On the PC, the console will print TRUE, but clearly that's wrong because the values should be equal. On the Mac, the console prints nothing, as it should be. This bug is present on the PC in R9, R10 and R11.

      Adios,
      Cactus Dan

      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 20/07/2009 at 23:45, xxxxxxxx wrote:

        Hi Cactus,

        by the way, comparing floats with the == operator is not recommended. Take a look at this: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

        Yes I know, its a big topic but sometimes its goot to know.

        Bye, Shawni

        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/07/2009 at 06:04, xxxxxxxx wrote:

          Rule of thumb, don´t call a function as an if condition. 😉

          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/07/2009 at 06:12, xxxxxxxx wrote:

            Howdy,

            Yes, I understand that about floating point imprecision.

            But the odd thing about the comparison is that if the previously posted code is changed to this:

            > Bool TestCommand::Execute(BaseDocument\* doc) \> { \>      Vector a = Vector(46,46,46), b = Vector(0,0,0); \>      Real length = Len(a-b); \>       \>      Real vLen = Len(a-b); \>      if(vLen < length) GePrint("TRUE"); \>       \>      return TRUE; \> }

            Then it works on both Mac and PC.

            So, I've gone through all of my code looking for the Len() function and if it's used in an if() statement, add a Real storage variable just before the if() statement and compare the two variables instead. ;o)

            Adios,
            Cactus Dan

            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/07/2009 at 06:13, xxxxxxxx wrote:

              Howdy,

              > Quote: Originally posted by 3D Designer on 21 July 2009
              >
              > * * *
              >
              > Rule of thumb, don´t call a function as an if condition. 😉
              >
              >
              > * * *

              Yes, it seems that is the case here. ;o)

              Adios,
              Cactus Dan

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