Screen Coords
-
Does anyone knows or has the source code for function
view.screen_coords
or not the actual code, but something similiar to that?I want to examine how it works and more stuff. I have looked in blender source code as someone previously sugested, but haven't found the function that could convert 3d pos to screen coords.
-
Your question is cryptic. What do you want? Do you want to convert a Point3d location in the model into screen coordinates?
Or are you writing your own 3d modeling software and you want to figure out how to convert a 3d point in your software into screen coordinates?
Or why isn't the SketchUp method provided good enough? What is it lacking?
Based on your actual question:
@anton_s said:
Does anyone knows or has the source code for function view.screen_coords or not the actual code, but something similiar to that?
The answer is "no". Google does not publish SketchUp's uncompiled code. So none of us have a copy of it sitting around.
-
Its not really about sketchup, but I just want to write my own function that would convert 3d pos to 2d by having parameter as: camera pos(eye), camera target, camera up and view type(perspective or parallel)
I still don't have too much math about 3d space and perspective stuff, so I decided to ask here for help. A good url to some learning would also help.
-
What are you doing the 3d programming in?
-
@chris fullmer said:
What are you doing the 3d programming in?
Rightnow, in Sketchup. Later, in other 3d space softwares.
-
You're not really doing 3d programming though. You're interfacing with a 3d SketchUp model.
I think this is a hard question to answer because you don't fully understand what your asking.
So again, what is it about SketchUp's native screen coordinates tool that is not enough?
My suggestions would be to master the SketchUp API. Then when you are ready to move on to a different software, you can learn their API. They will probably also have a way to supply you with the screen coordinates of a 3d point.
But again, what is it that you really want? You're asking about how to get the screen coordinates. Well, use the SketchUp API. But what about that is not a good enough answer? What more do you need it to do?
-
@chris fullmer said:
But again, what is it that you really want? You're asking about how to get the screen coordinates. Well, use the SketchUp API. But what about that is not a good enough answer? What more do you need it to do?
Rightnow I'm good with sketchup and I hopely mastered the API.
If I would wan't something to sketchup, I will post to SU[n] wishes.
What I wanted was just some more skills on perspective drawings. Sketchup doesn't has to do with what I want, it's an example, which has a defined function that could clone 3d pos to 2d. The defined function it self has parameters, which are
view
and 3d pos. I was trying to learn what code or math calculations the function does to clone the 3d coordinates to 2d coordinates.Chris, is that clear enough?
-
Ok, it sounds like you're generally interested in calculating 3d graphics.
Going from a 3d point to a 2d plane is called 3d projection:
http://en.wikipedia.org/wiki/3D_projection
The way you implement that varies by software, but the principle is the same. So read up on that, and it will enlighten you (or confuse you if you were me)
-
Okay, Thanks
Advertisement