POV-Ray : Newsgroups : povray.binaries.scene-files : Graphical projection comparison Server Time
23 Feb 2024 02:41:06 EST (-0500)
  Graphical projection comparison (Message 6 to 15 of 15)  
<<< Previous 5 Messages Goto Initial 10 Messages
From: Kenneth
Subject: Re: Graphical projection comparison
Date: 4 May 2017 12:10:01
Message: <web.590b519f3e0a9077883fb31c0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:

>
> I forgot that in my version of "screen.inc" I added a macro called
> "Get_Screen_XY" ...

Yeah, I was perplexed as to how the 'vanilla' version of screen.inc could do
that.

This looks interesting. Thanks for posting your modified version.


Post a reply to this message

From: Bald Eagle
Subject: Re: Graphical projection comparison
Date: 4 May 2017 12:45:01
Message: <web.590b5a753e0a9077c437ac910@news.povray.org>
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 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 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'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.


Post a reply to this message

From: Mike Horvath
Subject: Re: Graphical projection comparison
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

From: Mike Horvath
Subject: Re: Graphical projection comparison
Date: 4 May 2017 13:26:32
Message: <590b6448$1@news.povray.org>
On 5/4/2017 12:44 PM, Bald Eagle wrote:
> 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 checked the code once again, an it may be already possible to do this 
by adjusting the "Scaling" parameter of the "Screen_Object" and 
"Screen_Plane" macros. I might be wrong though.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: Graphical projection comparison
Date: 4 May 2017 15:32:40
Message: <590b81d8@news.povray.org>
Update in the attachment.


Mike


Post a reply to this message


Attachments:
Download 'wp_graphical_projection_examples_20170505.zip' (313 KB)

From: Kenneth
Subject: Re: Graphical projection comparison
Date: 5 May 2017 00:45:00
Message: <web.590c024a3e0a9077883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> 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.

That's a new trick to me; I thought Verbose was only for
use in an .ini file (I'm running Windows.) Could you explain how you use it or
how you make it work? I tried simply sticking  #declare Verbose=on  in the
middle of a scene file, but didn't see anything different(?) in the message
stream after the render. I'm *obviously* not 'getting it'... :-(  Is it used in
conjunction with #debug somehow? Do other .ini parameters need changing too?

Thanks. This looks to be quite useful!


Post a reply to this message

From: Bald Eagle
Subject: Re: Graphical projection comparison
Date: 5 May 2017 07:55:01
Message: <web.590c678d3e0a9077c437ac910@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> That's a new trick to me; I thought Verbose was only for
> use in an .ini file (I'm running Windows.)

Ha!  And there's something _I_ was unaware of.   :O

> Could you explain how you use it or
> how you make it work? I tried simply sticking  #declare Verbose=on  in the
> middle of a scene file, but didn't see anything different(?) in the message
> stream after the render. I'm *obviously* not 'getting it'... :-(  Is it used in
> conjunction with #debug somehow? Do other .ini parameters need changing too?
>
> Thanks. This looks to be quite useful!

It's not an internal POV-Ray thing - I write it into the macro or SDL myself.

If I have a complicated scene, there may be a lot of
#if (Verbose)
     #debug blah blah blah value1 value2 vectorA, etc
#end // end if Verbose

sprinkled throughout the scene,

and if I write a macro, I'll spit out messages that it's been included, that
it's just gotten invoked, what variables it's working with, what their values
are, a help/man-page style usage example, end when the macro exits.

It's just a better and "more convenient" way for me to get documentation and see
what's going on without having to track down a separate ini or mcr file or open
a help page or search through the code to see what the heck I mis-coded (again)
THIS time.

Sorry for the confusion


Post a reply to this message

From: Kenneth
Subject: Re: Graphical projection comparison
Date: 5 May 2017 12:30:01
Message: <web.590ca7bb3e0a9077883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

>
> It's not an internal POV-Ray thing - I write it into the macro or SDL myself.
>
> If I have a complicated scene, there may be a lot of
> #if (Verbose)
>      #debug blah blah blah value1 value2 vectorA, etc
> #end // end if Verbose
>
> sprinkled throughout the scene,
>

(***laughing out loud***)
OH, so *that's* what it means!! Thanks for clarifying. I haven't been so
thoroughly confused since I tried to understand the true nature of gravity. :-P

It just so happens that, right before I saw your post, I had been working with
POV-Ray's own "Verbose" command. So I naturally assumed... uh...

Had a good laugh over that one. :-)


Post a reply to this message

From: Bald Eagle
Subject: Re: Graphical projection comparison
Date: 12 May 2017 07:55:00
Message: <web.5915a21a3e0a9077c437ac910@news.povray.org>
Sorry for the delay  -  it's been a positively tumultuous week or two, and I
have to juggle files back and forth on a USB stick...

Here's a short scene that writes SVG objects directly to file.


Post a reply to this message


Attachments:
Download 'make_svg.pov.txt' (13 KB)

From: Mike Horvath
Subject: Re: Graphical projection comparison
Date: 22 May 2017 06:34:19
Message: <5922beab@news.povray.org>
Another update.

Mike


Post a reply to this message


Attachments:
Download 'wp_graphical_projection_examples_20170514.zip' (358 KB)

<<< Previous 5 Messages Goto Initial 10 Messages

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