On 02/03/2015 at 14:29, xxxxxxxx wrote:
Cinema 4D Version: R16 Stud
Platform: Mac OSX ;
Language(s) : C++ ;
I need to draw some text next to a point in the viewport.
Given this article https://developers.maxon.net/?p=496 I can draw the text. My question is how to convert from a position vector in global coordinates to the viewport. I think I need to use BaseDraw::SetMatrix_Matrix however I don't understand from the documentation how to do this.
I have a limited understanding of vector and matrix transformations, so please keep answers simple. If possible a code fragment would be helpful.
On 03/03/2015 at 13:49, xxxxxxxx wrote:
You probably have to set the matrix translation values with the call you mention, BaseDraw::SetMatrix_Matrix().
Here's a link to the documentation describing the matrix data type being used:
Matrix64 C4D data type
The vector in particular within the matrix that deals with translation values is called off. That is, you must set off's x, y, and z values, then pass the matrix as a parameter to the function call SetMatrix_Matrix().
Please try it out and let us know.
SDK Support Engineer
On 05/03/2015 at 08:44, xxxxxxxx wrote:
Thanks for your response. I had previously found the documentation for the matrix64. It describes the functions available however for novices like me if doesn't provide the basic information about when to use each such function.
I apologise for asking such a basic question, but are you able to point me in the direction of anything I can read which explains how matrices are used in c4d / computer graphics in general? Sadly whilst I've been writing software for several decades now, I have to confess that developing software to operate in the computer graphics arena is new to me.
Sorry for asking such a simple question. I will try what you suggest later however I'm not sure I understand why it might work or when I should use such an approach in future.
On 05/03/2015 at 16:25, xxxxxxxx wrote:
Sure, glad to help! Please consider that matrices are a fundamental part of 3D graphics. Fortunately, there are many sources of information, most notably a lot of well written books. The help you may find in Wikipedia and other online sources are OK, but they tend to be somewhat brief or written more as a reference than 'from scratch' learning material. It also somewhat depends on what kind of 3D graphics application you want to focus on. Photo realism, real-time simulations, games, etc. as the initial books will touch on many subtopics that apply to each, but you have to branch off at some point to focus on an application, or be stuck in learning mode forever.
Although I've learned from other 3D books, the most famous one I've heard of is
Computer Graphics: Principles and Practice
In University, the book my 3D graphics programming course used was Computer Graphics with OpenGL
As my personal focus to learn 3D was for computer games, I found "Tricks of the 3D Game Programming Gurus" by Andre LaMothe a really good source, as it starts from scratch with the math behind 3D, because it shows how to make a fully software based 3D engine, avoiding APIs like Direct3D and OpenGL. However, it doesn't seem to be in print anymore.
There are other books too, the above are suggestions from personal experience. I'd suggest checking out a selection at a bookstore and choosing the one that you prefer, as writing style and content vary greatly.