POV-Ray : Newsgroups : povray.binaries.scene-files : Graphical projection comparison : Re: Graphical projection comparison Server Time
19 Apr 2024 17:36:31 EDT (-0400)
  Re: Graphical projection comparison  
From: Mike Horvath
Date: 4 May 2017 13:18:19
Message: <590b625b$1@news.povray.org>
On 5/4/2017 12:44 PM, Bald Eagle wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>
>> I forgot that in my version of "screen.inc" I added a macro called
>> "Get_Screen_XY" that takes any 3D scene coordinate as input and outputs
>> the 2D screen coordinate, normalized between 0 and 1. This makes things
>> super simple!
>
> Hmmm.  I recall that Screen.inc uses a -0.5 to +0.5 range.
> Might you want to edit "Get_Screen_XY" to output THAT range, so that it would be
> easy to align things on the screen with objects in the image,
> and then rename the "Get_Screen_XY" to "Get_Image_XY" - since that might
> disambiguate things a bit?
>

I just checked the code again and realized the output is not normalized 
to between 0 and 1. Instead, it outputs a fraction of whatever 
image_width and image_height are. Switching back to -0.5 to +0.5 should 
be easy.


> I suppose if you're ambitious enough - you could flip those macros around and
> given a distance from the camera-right-up plane, you could return x,y,z
> coordinates to place an object into the scene, so that it would line up with a
> place on the screen or in the image.
>

I can't really remember the details of how the code works. It's been so 
long since I looked at this code. If you want to take a crack at it, go 
ahead.


>> I just list whatever points I want to project, and then
>> write the 2D locations to a text file.
>
> Since the SVG is just a text file, and you can clearly follow the syntax - why
> not just write the SVG header, output an SVG line definition, and add some
> triangles or whatnot, and get your usable SVG straight from POV-Ray?
> It would cut out a lot from the workflow.
> Just a suggestion.
>

I would have to rewrite this code for every scene I create. What if I 
want to change the colors? What if I want to add some text? Angle or 
distance measurements? Buttons and check boxes? This all means extra 
work compared to GeoGebra, which is WYSIWYG.


>> I've attached "screen.inc" to this post.
>
> Thank you :)
>
> One thing that might be useful is to include some reminders and usage info for
> output to the debug stream.
> I often
> #declare Verbose = true;
> in my scene, and then any macros or parts of the scene where I want to get data
> from check for that variable and then I get everything I want with just one
> "switch".
>
> I do the same thing with any weird command syntax that I use - I just output or
> include in the comments a working line of code using that command.
>

I don't think I modified the debug text from the original. This is all I 
could find:

	#ifdef(View_POV_Include_Stack)	#debug "including screen.inc\n"		#end


Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.