Mis number asub skaalal oranžist täpist (abs(DISTANCE)) ühiku võrra vasakulparemal? Skaalal olevate järjestikuste kriipsude vahe on 1 ühik.
Mis numbril oranž täpp asub? Skaalal olevate järjestikuste kriipsude vahe on 1 ühik.
init({
range: [ [ MIDPOINT-6, MIDPOINT+6 ], [ -1, 1 ] ]
});
line( [ MIDPOINT-5, 0 ], [ MIDPOINT+5, 0 ] );
line( [ MIDPOINT+4.7, 0.2 ], [ MIDPOINT+5, 0 ] );
line( [ MIDPOINT+4.7, -0.2 ], [ MIDPOINT+5, 0 ] );
for ( var x = MIDPOINT-5; x < MIDPOINT+5; x++ ) {
line( [ x, -0.2 ], [ x, 0.2 ] );
}
style({ stroke: "#6495ED", strokeWidth: 3.5 });
line( [ MIDPOINT, -0.2], [MIDPOINT, 0.2]);
label( [ MIDPOINT, -0.53 ], MIDPOINT, "center", { color: "#6495ED" });
style({ stroke: "#FFA500", fill: "#FFA500" });
graph.orangeDot = circle( [ NUMBER, 0 ], 0.10 );
Me teame, kus asub skaalal number MIDPOINT
, kuna see on juba tähistatud.
Numbrid, mis jäävad MIDPOINT
vasakule, on sellest väiksemad ja numbrid, mis jäävad MIDPOINT
paremale, on sellest suuremad.
Me peame leidma numbri, mis on skaalal tähistatud sinise täpiga, st oranžist täpist (abs(DISTANCE)) ühiku võrra vasakulparemal.
style({ stroke: "#6495ED", fill: "#6495ED" });
graph.blueDot = circle( [ NUMBER+DISTANCE, 0 ], 0.10 );
Alustades sinise täpi poole liikumist numbrist MIDPOINT
, liigume abs(NUMBER-MIDPOINT+DISTANCE)
ühikut vasakuleparemale, et jõuda siniseoranži täpini.
var color = "#6495ED";
if ( DISTANCE === 0 ) {
color = "#FFA500";
}
style({ stroke: color, fill: color, strokeWidth: 3.5, arrows: "->" });
line( [ MIDPOINT, 0 ], [ NUMBER+DISTANCE, 0 ] );
graph.blueDot.toFront();
Seega tähistab skaalal sinineoranž täpp numbrit NUMBER+DISTANCE
.
var color = "#6495ED";
if ( DISTANCE === 0 ) {
color = "#FFA500";
}
label( [ NUMBER, -0.53 ], NUMBER, "center", { color: "#FFA500" });
label( [ NUMBER+DISTANCE, -0.53 ], NUMBER+DISTANCE, "center", { color: color });