Page 2 of 4

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:01 am
by Walter
keithdalby wrote:
Tue Feb 13, 2018 7:44 am
Walter wrote:
Tue Feb 13, 2018 7:25 am
Tim Butler wrote:
Tue Feb 13, 2018 4:54 am
I'm totally open to constructive criticism as to if this is a totally bad idea for some reason ...
My English is insufficient for decoding that. Please explain what that shall mean. :?
"I'm open to constructive criticism with respect to whether this is a bad idea"

The superfluous "totally" that appears twice can be read like a 1990s California Valley girl from some naff sitcom, and the "for some reason" is a qualifier to express the author's doubt in their own statement. The "as to" is fine.
Thanks for explaining. We learn some new English here every once and a while. A pity this isn't a forum written in German - else I could return something.

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:27 am
by keithdalby
English is a fun language, because even native speakers can interpret sentences differently. Ambiguity is its biggest strength (for poetry) and its biggest weakness (for technical text). I read somewhere that Sanskrit would be a better technical language because of how it was invented to convey technical religious ideas, but I've no time to learn Sanskrit now. Or English, for that matter.

Tim might have meant, "For reasons I cannot fathom, I'm open to constructive criticism with no restriction on its content, particularly on the matter of whether this idea is worthwhile."

Or maybe, "I'm open to criticism" suffices. When the poetic nuances are removed, I think the message is the same.

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:37 am
by Walter
keithdalby wrote:
Tue Feb 13, 2018 9:27 am
English is a fun language, because even native speakers can interpret sentences differently. Ambiguity is its biggest strength (for poetry) and its biggest weakness (for technical text). I read somewhere that Sanskrit would be a better technical language because of how it was invented to convey technical religious ideas, but I've no time to learn Sanskrit now. Or English, for that matter.

Tim might have meant, "For reasons I cannot fathom, I'm open to constructive criticism with no restriction on its content, particularly on the matter of whether this idea is worthwhile."

Or maybe, "I'm open to criticism" suffices.
I like your last suggestion. I've heard that Latin, French, or German would be better mathematical/technical languages for various reasons. I've tried to learn the first two but decided to stick to the latter for obvious reasons.

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:41 am
by keithdalby
Walter wrote:
Tue Feb 13, 2018 9:37 am
decided to stick to [German] for obvious reasons.
I'm inflicted with being born in Britain and being subjected to an educational system and a culture that does not place value on learning other languages. I know enough French to survive a weekend in France and a little liturgical Pali, but I'm a native English speaker. Given that I usually cannot remember whether affect or effect is a verb or a noun, that says a lot about our educational system. And now, of course, I'm another brick in the wall myself, being a teacher.

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:47 am
by Tim Butler
Here's another example of LINE.
I've written a crude D3PLOT demo that uses a D3DRAW to render a matrix of homogenous coordinates
[[ x0 y0 z0 1] [ x1 y1 z1 1] ...] in a viewport configured by D3CFG.
d3demo_example.jpg
d3demo_example.jpg (16.26 KiB) Viewed 7271 times
Like, you totally knew this was coming, right?
It's sooo late eighties.

First run D3CFG to set the viewport.
Set the view variables and then PRESS R/S
to initialize the View transformation matrix.

r=distance from origin to viewpoint
theta=angle from X towards Y (degrees)
phi=declination from Z (degrees)
d = screen distance (more of a scaling factor)

r=10
theta=52
phi=72
d=11

Then run D3PLOT and set the X/Y range and steps.

XMIN=-10
XMAX=10
XN=40
YMIN=-10
YMAX=10
YN=40

It is hardcoded with the function NRMRESP.

The code was inspired by the "Perspective" chapter of the out of print "Programming Principles in Computer Graphics", Leendert Ammeraal.
I've got the perspective transformation disabled, because I was having trouble with it.
The quality of the code is "I just wanted to see if I could bang this out."
We need a gallery of beautiful OFFIMG screens that were *generated* by our little DM42s.

Code: Select all

00 { 869-Byte Prgm }
01▸LBL "D3CFG"
02 MVAR "r"
03 MVAR "theta"
04 MVAR "phi"
05 MVAR "d"
06 DEG
07 VARMENU "D3CFG"
08 STOP
09 EXITALL
10 4
11 ENTER
12 NEWMAT
13 STO "D3DV"
14 INDEX "D3DV"
15 MVAR "v11"
16 RCL "theta"
17 SIN
18 +/-
19 STOEL
20 J+
21 MVAR "v12"
22 RCL "phi"
23 COS
24 RCL "theta"
25 COS
26 ×
27 +/-
28 STOEL
29 J+
30 MVAR "v13"
31 RCL "phi"
32 SIN
33 RCL "theta"
34 COS
35 ×
36 +/-
37 STOEL
38 J+
39 J+
40 MVAR "v21"
41 RCL "theta"
42 COS
43 STOEL
44 J+
45 MVAR "v22"
46 RCL "phi"
47 COS
48 RCL "theta"
49 SIN
50 ×
51 +/-
52 STOEL
53 J+
54 MVAR "v23"
55 RCL "phi"
56 SIN
57 RCL "theta"
58 SIN
59 ×
60 +/-
61 STOEL
62 J+
63 J+
64 J+
65 MVAR "v32"
66 RCL "phi"
67 SIN
68 STOEL
69 J+
70 MVAR "v33"
71 RCL "phi"
72 COS
73 +/-
74 STOEL
75 I+
76 MVAR "v43"
77 RCL "r"
78 STOEL
79 J+
80 MVAR "v44"
81 1
82 STOEL
83 RTN
84▸LBL "D3DRAW"
85 RCL× "D3DV"
86 STO "D3DE"
87 INDEX "D3DE"
88 GTO 03
89 MVAR "etop"
90▸LBL 01
91 J+
92 J+
93 RCLEL
94 J-
95 RCLEL
96 RCL÷ ST Y
97 STOEL
98 J-
99 RCLEL
100 RCL÷ ST Z
101 STOEL
102 I+
103 FC? 76
104 GTO 01
105▸LBL 03
106 MVAR "deletez"
107 RCL "D3DE"
108 DIM?
109 RCL ST Y
110 X<>Y
111 CLX
112 1
113 GETM
114 RCL× "d"
115 RCL "ResX"
116 2
117 ÷
118 +
119 J+
120 RCL ST Y
121 1
122 GETM
123 RCL× "d"
124 +/-
125 RCL "ResY"
126 2
127 ÷
128 +
129 COMPLEX
130 XEQ "PATH"
131 RTN
132 MVAR "v180212"
133 END
134▸LBL "NRMRESP"
135 RCL "X"
136 RCL "Y"
137▸LBL "NRMR2"
138 RAD
139 X↑2
140 X<>Y
141 X↑2
142 +
143 SQRT
144 SIN
145 LASTX
146 X=0?
147 GTO 00
148 ÷
149 10
150 ×
151 RTN
152▸LBL 00
153 10
154 RTN
155 MVAR "v180212"
156 END
157▸LBL "D3PLOT"
158 MVAR "XMIN"
159 MVAR "XMAX"
160 MVAR "XN"
161 MVAR "YMIN"
162 MVAR "YMAX"
163 MVAR "YN"
164 VARMENU "D3PLOT"
165 STOP
166 EXITALL
167 MVAR "deltaxy"
168 RCL "XMAX"
169 RCL- "XMIN"
170 RCL÷ "XN"
171 STO 01
172 RCL "YMAX"
173 RCL- "YMIN"
174 RCL÷ "YN"
175 STO 02
176 MVAR "fory"
177 RCL "YMIN"
178 STO "Y"
179 RCL "YN"
180 1
181 +
182 STO 06
183 4
184 NEWMAT
185 STO "D3DYPTH"
186 MVAR "forx"
187▸LBL 01
188 INDEX "D3DYPTH"
189 RCL "XN"
190 1
191 +
192 STO 05
193 RCL "XMIN"
194 STO "X"
195▸LBL 02
196 RCL "X"
197 STOEL
198 J+
199 RCL "Y"
200 STOEL
201 J+
202 XEQ "NRMRESP"
203 STOEL
204 J+
205 1
206 STOEL
207 J+
208 MVAR "nextx"
209 RCL 01
210 STO+ "X"
211 DSE 05
212 GTO 02
213 RCL "D3DYPTH"
214 XEQ "D3DRAW"
215 MVAR "nexty"
216 RCL 02
217 STO+ "Y"
218 DSE 06
219 GTO 01
220 MVAR "initx2"
221 RCL "XMIN"
222 STO "X"
223 RCL "XN"
224 1
225 +
226 STO 05
227 4
228 NEWMAT
229 STO "D3DXPTH"
230 MVAR "forx2"
231▸LBL 03
232 INDEX "D3DXPTH"
233 RCL "YN"
234 1
235 +
236 STO 06
237 RCL "YMIN"
238 STO "Y"
239▸LBL 04
240 RCL "X"
241 STOEL
242 J+
243 RCL "Y"
244 STOEL
245 J+
246 XEQ "NRMRESP"
247 STOEL
248 J+
249 1
250 STOEL
251 J+
252 MVAR "nexty2"
253 RCL 02
254 STO+ "Y"
255 DSE 06
256 GTO 04
257 RCL "D3DXPTH"
258 XEQ "D3DRAW"
259 MVAR "nextx2"
260 RCL 01
261 STO+ "X"
262 DSE 05
263 GTO 03
264 RTN
265 MVAR "v180212"
266 END
d3demo180212_raw.zip
(640 Bytes) Downloaded 352 times
-tim

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:49 am
by keithdalby
Tim Butler wrote:
Tue Feb 13, 2018 9:47 am
Here's another example of LINE.
Tim, that's phenomenal!

Re: Line drawing support

Posted: Tue Feb 13, 2018 9:51 am
by Tim Butler
Thomas Okken wrote:
Tue Feb 13, 2018 6:29 am

I wouldn't worry about the cost of executing MVAR or other no-ops. Executing programs is pretty efficient. You can see all the relevant code just by looking at continue_running() in common/core_main.cc.
Thanks for taking the time to confirm this.
It's wonderful to have an authoritative answer
and the Free42 source is the best HP42 spec and reference that exists.

-tim

Re: Line drawing support

Posted: Tue Feb 13, 2018 10:25 am
by Vitasam
Tim Butler wrote:
Tue Feb 13, 2018 9:47 am
Here's another example of LINE.
I've written a crude D3PLOT demo that uses a D3DRAW to render a matrix of homogenous coordinates
Trying D3PLOT and getting 'Nonexistent' message, at line

Code: Select all

85 RCLx "D3DV"

Re: Line drawing support

Posted: Tue Feb 13, 2018 10:39 am
by Tim Butler
Vitasam wrote:
Tue Feb 13, 2018 10:25 am
Tim Butler wrote:
Tue Feb 13, 2018 9:47 am
Here's another example of LINE.
I've written a crude D3PLOT demo that uses a D3DRAW to render a matrix of homogenous coordinates
Trying D3PLOT and getting 'Nonexistent' message, at line

Code: Select all

85 RCLx "D3DV"
First run D3CFG to set the viewport.
Set the view variables and then PRESS R/S
to initialize the View transformation matrix.

-tim

Re: Line drawing support

Posted: Tue Feb 13, 2018 11:39 am
by Vitasam
Tim Butler wrote:
Tue Feb 13, 2018 10:39 am
First run D3CFG to set the viewport.
Set the view variables and then PRESS R/S
to initialize the View transformation matrix.
Thanks! I just missed this point (R/S is needed after D3CGF).

Now it works