POV-Ray : Newsgroups : povray.general : torus arrows Server Time
26 Apr 2024 12:34:37 EDT (-0400)
  torus arrows (Message 9 to 18 of 18)  
<<< Previous 8 Messages Goto Initial 10 Messages
From: isuc60
Subject: Re: torus arrows
Date: 14 Nov 2016 19:50:06
Message: <web.582a5a7a329b68a8116828db0@news.povray.org>
Thank all of you so much for your great help!

This is an awesome platform. My skill grows everyday. Now, I am able to use most
of techniques that you introduced.

Here comes with a new challenge. I want to read data from a file on my disk. The
data file has something like this

1.0, 2.0,3.0, 4.0, 5.0, 6.0
7.0, 8.0, 9.0, 10.0,11.0,12.0

I want to draw an arrow from
Vector (1,2,3) to Vector (4,5,6)
and so on.

I read most of the 2.8.4.3 File Input/Output, and one post on the forum.
This is my first script.

//---------------------Head------------------------

#declare Vector1 = array[2][3] //2 rows and 3 columns
#declare Vector2 = array[2][3]

#fopen MyFile "data" read
#fopen MyFile1 "data.out" write
#while (defined(MyFile))
#read (MyFile,VECTOR_IDENTIFIER,Vector1,Vector2)
#write (MyFile1,VECTOR_IDENTIFIER,Vector1,Vector2)// check what I am reading in
any data
#end
//---------------------end--------------------------------

Hey, this does not work. It only reads one line, and even the output has a wrong
number.

I would appreciate it if you could point out my mistakes.

Thanks a lot again!

Best wishes,

Guoping



"Bald Eagle" <cre### [at] netscapenet> wrote:
> Stephen <mca### [at] aolcom> wrote:
> >... you might get a better idea of your scene if you do
> > a render from the top, front and side. To adjust the translations and
> > see what is happening.
> >
> > Another thing that might be confusing is PovRay's coordinate system.
> > Normally the Y axis is up. Some other programs use the Z axis for up.
>
> Yes.
> Take all of your objects and put them inside one big union{}
>
> #declare Scene = union {
> (all of your scene objects)
> }
>
> Then you can:
> object {Scene translate x*10 rotate  y*90}
> object {Scene translate y*10 rotate -x*90}
>
> to get 3 orthogonal views.
>
> Stephen's suggestion about mapping out the axes so that you can keep track is a
> great one - it helps keep everything straight when you're trying to write SDL
> and get all the parameters right.
>
> Also, when using a difference, I find it helpful to define the object being
> subtracted as a separate object, then use it in the difference{}, but also PLACE
> IT into the scene with something like pigment {rgbt <1, 0, 0, 0.95>} so that it
> shows up as a transparent thing that you can see.   Because sometimes you make a
> mistake and the thing you want to subtract isn't in the right place or
> orientations at all, and this helps debug the scene.
>
> Great work so far - keep it up   :)


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 15 Nov 2016 08:25:01
Message: <web.582b0bf9329b68a8b488d9aa0@news.povray.org>
I'm at work now, but give this a look and see if this example scene helps


http://news.povray.org/povray.binaries.scene-files/thread/%3Cweb.56d702f78f8162b55e7df57c0%40news.povray.org%3E/


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 15 Nov 2016 10:20:00
Message: <web.582b2728329b68a8b488d9aa0@news.povray.org>
Aha.
You're trying to read and write whole vectors.
Split them into scalar values, because read/write does on value at a time.

Try the below code - it ought to work.

//---------------------Head------------------------

#declare Vector1 = array[2][3] //2 rows and 3 columns
#declare Vector2 = array[2][3]

#fopen MyFile "data.txt" read
#fopen MyFile1 "data.out" write

#while (defined(MyFile))
#read  (MyFile, Scalar1, Scalar2, Scalar3, Scalar4, Scalar5, Scalar6)
// {Be sure to include debug.inc file!}
#debug concat( " Scalar1 = ", str(Scalar1, 3, 1),  " Scalar2 = ", str(Scalar2,
3, 1), " Scalar3 = ", str(Scalar3, 3, 1), "\n")
#debug concat( " Scalar4 = ", str(Scalar4, 3, 1),  " Scalar5 = ", str(Scalar5,
3, 1), " Scalar6 = ", str(Scalar6, 3, 1), "\n")

#declare Vector1 = <Scalar1, Scalar2, Scalar3>;
#declare Vector2 = <Scalar4, Scalar5, Scalar6>;

#debug concat( "Vector1 = ", vstr(3, Vector1, ", ", 3, 0), " \n")
#debug concat( "Vector2 = ", vstr(3, Vector2, ", ", 3, 0), " \n")

#debug " \n \n"
#write (MyFile1, Scalar1, Scalar2, Scalar3, Scalar4, Scalar5, Scalar6)// check
what I am reading in any data
#end

#fclose MyFile
#fclose MyFile1
//---------------------end--------------------------------


Post a reply to this message

From: isuc60
Subject: Re: torus arrows
Date: 17 Nov 2016 21:40:01
Message: <web.582e693b329b68a8116828db0@news.povray.org>
Dear Bald Eagle,

Thank you so much for taking the time to explain this to me!

It worked so beautifully.

I was able to alter it to meet my needs.

I really appreciate your great help!

Best regards,

Guoping

"Bald Eagle" <cre### [at] netscapenet> wrote:
> Aha.
> You're trying to read and write whole vectors.
> Split them into scalar values, because read/write does on value at a time.
>
> Try the below code - it ought to work.
>
> //---------------------Head------------------------
>
> #declare Vector1 = array[2][3] //2 rows and 3 columns
> #declare Vector2 = array[2][3]
>
> #fopen MyFile "data.txt" read
> #fopen MyFile1 "data.out" write
>
> #while (defined(MyFile))
> #read  (MyFile, Scalar1, Scalar2, Scalar3, Scalar4, Scalar5, Scalar6)
> // {Be sure to include debug.inc file!}
> #debug concat( " Scalar1 = ", str(Scalar1, 3, 1),  " Scalar2 = ", str(Scalar2,
> 3, 1), " Scalar3 = ", str(Scalar3, 3, 1), "\n")
> #debug concat( " Scalar4 = ", str(Scalar4, 3, 1),  " Scalar5 = ", str(Scalar5,
> 3, 1), " Scalar6 = ", str(Scalar6, 3, 1), "\n")
>
> #declare Vector1 = <Scalar1, Scalar2, Scalar3>;
> #declare Vector2 = <Scalar4, Scalar5, Scalar6>;
>
> #debug concat( "Vector1 = ", vstr(3, Vector1, ", ", 3, 0), " \n")
> #debug concat( "Vector2 = ", vstr(3, Vector2, ", ", 3, 0), " \n")
>
> #debug " \n \n"
> #write (MyFile1, Scalar1, Scalar2, Scalar3, Scalar4, Scalar5, Scalar6)// check
> what I am reading in any data
> #end
>
> #fclose MyFile
> #fclose MyFile1
> //---------------------end--------------------------------


Post a reply to this message

From: Bald Eagle
Subject: Re: torus arrows
Date: 18 Nov 2016 08:00:00
Message: <web.582efaaa329b68a8c437ac910@news.povray.org>
"isuc60" <isu### [at] gmailcom> wrote:
> Dear Bald Eagle,
>
> Thank you so much for taking the time to explain this to me!

Sure thing, Guoping - that's exactly what this group is for.

> It worked so beautifully.
> I was able to alter it to meet my needs.

Glad to hear it - I hope you're enjoying POV-Ray as much as the rest of us do

> I really appreciate your great help!

The rest of the crew can tell you that I've received my very own mountain of
help over the years   ;)
Glad to have cleared that up for you


Post a reply to this message

From: Stephen
Subject: Re: torus arrows
Date: 18 Nov 2016 11:01:35
Message: <582f25df$1@news.povray.org>
On 11/18/2016 12:57 PM, Bald Eagle wrote:
> The rest of the crew can tell you that I've received my very own mountain of
> help over the years;)

As have we all over the years. :)

I hope your stay here is a long one.

-- 

Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: torus arrows
Date: 22 Nov 2016 02:50:54
Message: <5833f8de$1@news.povray.org>
Am 22.11.2016 um 08:27 schrieb Mike Horvath:

> Your link is NSFW!!

You quoting it didn't make it less NSFW... *sigh*


Post a reply to this message

From: clipka
Subject: Re: torus arrows
Date: 22 Nov 2016 03:27:23
Message: <5834016b$1@news.povray.org>
Am 22.11.2016 um 08:50 schrieb clipka:
> Am 22.11.2016 um 08:27 schrieb Mike Horvath:
> 
>> Your link is NSFW!!
> 
> You quoting it didn't make it less NSFW... *sigh*

FYI: Revoked two posts in this thread, not primarily because they linked
to a web page with NSFW content, but because the linked page seemed
rather bogus in general.

Sorry folks, but I don't think we want people to potentially catch
drive-by malware from following links in these newsgroups.


Post a reply to this message

From: Stephen
Subject: Re: torus arrows
Date: 22 Nov 2016 04:05:22
Message: <58340a52$1@news.povray.org>
On 11/22/2016 8:27 AM, clipka wrote:
> Am 22.11.2016 um 08:50 schrieb clipka:
>> Am 22.11.2016 um 08:27 schrieb Mike Horvath:
>>
>>> Your link is NSFW!!
>>
>> You quoting it didn't make it less NSFW... *sigh*
>
> FYI: Revoked two posts in this thread, not primarily because they linked
> to a web page with NSFW content, but because the linked page seemed
> rather bogus in general.
>
> Sorry folks, but I don't think we want people to potentially catch
> drive-by malware from following links in these newsgroups.
>


Good show! that chap. :)

-- 

Regards
     Stephen


Post a reply to this message

From: Alain
Subject: Re: torus arrows
Date: 22 Nov 2016 16:47:32
Message: <5834bcf4$1@news.povray.org>

> Am 22.11.2016 um 08:50 schrieb clipka:
>> Am 22.11.2016 um 08:27 schrieb Mike Horvath:
>>
>>> Your link is NSFW!!
>>
>> You quoting it didn't make it less NSFW... *sigh*
>
> FYI: Revoked two posts in this thread, not primarily because they linked
> to a web page with NSFW content, but because the linked page seemed
> rather bogus in general.
>
> Sorry folks, but I don't think we want people to potentially catch
> drive-by malware from following links in these newsgroups.
>
Good move.


Post a reply to this message

<<< Previous 8 Messages Goto Initial 10 Messages

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