NO

Author Topic: Vanish Lines  (Read 1105 times)

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Vanish Lines
« on: January 18, 2023, 04:36:09 PM »
Hello the ghosts

A small program to play with vanish lines.
It is an attempt I wanted to see what they can be.

There are two files (*.van) that can be edited with the NotePad.
They contents all the parameters and the description of the image.
The first time set :

[Parameters]
Compute my datas=1
Update my datas=1

It centers the image between the horizon line and the bottom of the screen.
If the image is too hight to fill in this area, it is centered from the top and the bottom of the client area.
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #1 on: January 18, 2023, 07:00:03 PM »
In this version I use MoveToEx and LineTo to draw the lines. I use LineDDA to find the last point.
So the points are not to the good place.
I tried a Bensenham formula but that is wrong because of Microsoft must use another formula for calculate the slope of the line.

Drawing vanish lines is a problem because there are no parallel lines.
Each line has its own angle.

In the next version I will use the plot function with my own lines computing algo.

For the slope I will use : m = (Y2 - Y1) / (X2 - X1)
The line formula is: Y = aX + b where "a" can be replaced by "m"
and b is b = Y1 - mX1

Many good times in perspective
--------------------------------
Kenavo

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Vanish Lines
« Reply #2 on: January 19, 2023, 02:05:26 PM »
Note: once downloaded and extracted you'll need to edit the provided .van file(s) to change the File path to wherever the installation is placed.  Otherwise you will get an error about loading image into memory....

Edit the top 'File=.....' to the correct path to the .van file.

John Z

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 175
    • Bcx Basic to C/C++ Translator
Re: Vanish Lines
« Reply #3 on: January 19, 2023, 03:48:51 PM »
Note: once downloaded and extracted you'll need to edit the provided .van file(s) to change the File path to wherever the installation is placed.  Otherwise you will get an error about loading image into memory....

Edit the top 'File=.....' to the correct path to the .van file.

John Z

I found removing the path entirely, leaving only the filename, was sufficient.
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #4 on: January 26, 2023, 03:25:57 PM »
Here is a new version.
The examples files contain all the documentation.
When you create a new file (empty file) all is documented and prepared.
This is not the final version but after many tests it seems correct.
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #5 on: January 26, 2023, 03:27:16 PM »
Some examples
--------------------------------
Kenavo

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Vanish Lines
« Reply #6 on: January 27, 2023, 12:18:50 PM »
It is fairly amazing!  I like the shuttle the most being a space fan of course.

I just don't think I've the patience to draw something point by point in my head then write
each of the the 4x4 object 'projections?'. !  I'll need to study this a bit more and your code.  :)

Not mentioned is the Color setting is it just the RGB? I guess so.

Just to try to understand, I applied the shuttle .van file to the crayon.jpg .... ;D ;D ;D

John Z

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #7 on: January 27, 2023, 01:17:18 PM »
The man in the shuttle is writing to who?
The colors are in rgb. You can store it as 0x00123456 or in decimal.
I have an other version but I can't upload it, because of 1024kb...
--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #8 on: January 27, 2023, 01:18:54 PM »
I will try to add things like Rectangle, Circle...
But I have a cake to do before... ;D
--------------------------------
Kenavo

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 175
    • Bcx Basic to C/C++ Translator
Re: Vanish Lines
« Reply #9 on: January 27, 2023, 06:10:37 PM »
Observation No. 1:
I worked with AutoCad and Microstation for many years, so I am more familiar than most when it comes to computer-aided drafting.  I'm also familiar with design software from Adobe and SVG software like Inkscape.  But I'm puzzled about your app.  While I respect the effort that goes into programming, I don't understand your app's purpose/goal or what niche it wants to occupy.

Observation No. 2:
I just realized that Grincheux and HellOfMice are the same person and that the Grincheux account was deleted and that all his posts now say the author was Grincheux [Guest].
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #10 on: January 27, 2023, 06:19:34 PM »
Usually perpective is drawn with an angle between 30 to 45 degrees.
All the lines have the same angle.
In paintings they don't use perspective but vanish lines to force
the user to look at a point the painter wanted.
So, the goal of the program is to show what is a vanish line.
Forget all the softwares like AutoCad, it is not for making any kind
of 3D or perspective. Just to display how to deform an image.


The rails of the railways are parallel yet they intersect...
When you see them, there is a vanish line.

Thank you for your comment.

Grincheux is me, I lost my password, so I created an other account.
--------------------------------
Kenavo

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 175
    • Bcx Basic to C/C++ Translator
Re: Vanish Lines
« Reply #11 on: January 27, 2023, 06:46:51 PM »
Thanks for the explanations ( including the really tiny ones ).

I've been married to an artist for 45 years, so I'm constantly forced to look at things differently.    ;)

Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #12 on: January 27, 2023, 06:49:40 PM »
I have forgotten to say that  it was for my pleasure.
I said to myself that it could be interesting for someone.

--------------------------------
Kenavo

Offline HellOfMice

  • Member
  • *
  • Posts: 62
  • Never be pleased, always improve
Re: Vanish Lines
« Reply #13 on: January 27, 2023, 09:17:10 PM »
In the program I have two vanish points
1-0,100
2-rc.right,100


x------------------------------------------------------x X = Vanish points
 !           !
   !          !
    !          ! With the same angle the lines are parallels
     !          ! The point H(2) looks at the pont 'x' on the horizon line
      !          ! It cannot have the same angle than the other line
       !          !
.......H-------H.(2)....................................


The image joint will help to understand.
--------------------------------
Kenavo

Offline John Z

  • Member
  • *
  • Posts: 790
Re: Vanish Lines
« Reply #14 on: January 28, 2023, 12:29:00 PM »

The rails of the railways are parallel yet they intersect...
When you see them, there is a vanish line.


Close one eye  ;) to fix this illusion  :) :)

John Z