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

    Old Coffee "vnorm" term to python

    General Talk
    2
    3
    980
    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.
    • C
      ceen
      last edited by

      Hi,
      digging into my age old C4D files I found a setup with a xpresso coffee node that uses the "vnorm" for vector normalization in multiplication of two vectors. What is the python equivalent for that? I have basically no python skill so help is highly appreciated. Thank you!

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ceen
        last edited by ferdinand

        Hello @ceen,

        Thank you for reaching out to us. It is always best to share code to clear up ambiguties because vnorm does not ring a bell for me. COFFEE was just wrapping the C++ API just as Python does. And I am not aware of a method vnorm for the vector types of Cinema 4D, either you are misinterpreting the script, or it is really, really old, something like R6 or so (did COFFEE even exist then?).

        However, this sounds very much like vector normalization. You should just look at c4d.Vector in our docs, but long story short, this is how normalization works in the Cinema 4D API (since pretty much forever), here at the example of Python but C++ is more or less the same:

        >>> import c4d
        >>> v: c4d.Vector = c4d.Vector(1, 2, 3)
        >>> v
        Vector(1, 2, 3)
        >>> n: c4d.Vector = v.GetNormalized() # Get a normalized copy of #v
        >>> n
        Vector(0.267, 0.535, 0.802)
        >>> m: c4d.Vector = ~v # Tilde is the operator shorthand for GetNormalized.
        >>> m
        Vector(0.267, 0.535, 0.802)
        >>> v.Normalize() # This normalizes the instance itself, i.e., #v itself is modified.
        >>> v
        Vector(0.267, 0.535, 0.802)
        

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        C 1 Reply Last reply Reply Quote 0
        • C
          ceen @ferdinand
          last edited by

          @ferdinand Thank you! you can find it in the old coffee help "using matrices" tutorial section:

          88c1a768-9234-4fe1-b6eb-c93e4d2ebf6a-grafik.png

          My own code is ridicoulusly simple:

          main()
          {
          ang = ( vnorm(vector1) * vnorm(vector2)) ;
          }

          Just looking for a python "vnorm"

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