Post Reply 
GROBW/GROBH vs GROBW_P/GROBH_P
10-11-2018, 01:27 PM (This post was last modified: 10-11-2018 01:32 PM by sasa.)
Post: #7
RE: GROBW/GROBH vs GROBW_P/GROBH_P
(10-11-2018 09:18 AM)toml_12953 Wrote:  The beauty of using Cartesian coordinates is that you can define the screen to be anything you want. (0,0) can be in the lower left if you only want to deal with quadrant 1. See how much simpler the following program is with a user-defined coordinate system?

It is not a point at all about clearness...

Quote:Think of how you'd have to write those LINE and PIXON statements if (0,0) was the upper-left corner and (319,239) was the lower-right!

Several problems I noticed in your program:

1. You changing global settings and not return previous. That force other programmers to return default or its own settings in order to ensure his program to work correctly.
2. The line contains "Ymin=-.85; Ymax=1;" which do nothing in Pascal and here with PPL - it compare content only (usage := )... Usual bug for all people to mix assign and compare signs comes from c-like programming languages to Pascal and vice versa.
3. Step of 0.01 is quite optimistic. It should be calculated regarding the length. Then will be drawn much more accurately and with minimum steps... Anyway, that is not important much on this small screen.

Not an issue at all to make corrections, on desktop programming that is only way.

Your a bit modified sample:
Code:

EXPORT SINWAVE()
BEGIN

local W := 320;
local H := 240;
local W2:= W/2;
local H2:= H/2;

RECT(0);
LINE_P(0,H2,W,H2,#777777);
FOR A FROM 0 TO 2*PI STEP 0.01 DO
  PIXON_P(A/(2*PI)*W,-SIN(A)*H2+H2,#00FF00);
  PIXON_P(A/(2*PI)*W,-COS(A)*H2+H2,#0000FF);
END;
FREEZE;
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-10-2018, 11:27 PM
RE: GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-11-2018, 02:34 AM
RE: GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-11-2018 01:27 PM
RE: GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-11-2018, 07:34 PM
RE: GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-11-2018, 12:52 PM
RE: GROBW/GROBH vs GROBW_P/GROBH_P - sasa - 10-12-2018, 06:46 AM



User(s) browsing this thread: 1 Guest(s)