Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //|/////////////////////////:DIAGRAM[SC[DIA_TILTEX_ULTRA]]///|//
- //| |//
- //| //|/////////////////:DIAGRAM[SC[DIA_TILTEX]]:|// |//
- //| //| |// |//
- //| //| Working out logic using a 4x4 tilemap: |// |//
- //| //| |// |//
- //| //| TILE[ 0 ]: ( 0 + 0.5 ) / 4 === 0.125 |// |//
- //| //| TILE[ 1 ]: ( 1 + 0.5 ) / 4 === 0.375 |// |//
- //| //| TILE[ 2 ]: ( 2 + 0.5 ) / 4 === 0.625 |// |//
- //| //| TILE[ 3 ]: ( 3 + 0.5 ) / 4 === 0.875 |// |//
- //| //| |// |//
- //| //| |<----- 4 pixels / texels ----->| |// |//
- //| //| +---+---+---+---+---+---+---+---+ |// |//
- //| //| | | | | | |// |//
- //| //| + 0 + 1 + 2 + 3 + <<<<< |// |//
- //| //| | | | | | ^^ |// |//
- //| //| +---+---+---+---+---+---+---+---+ ^^ |// |//
- //| //| ^ ^ .25 ^ 0.5 ^ .75 ^ ^ ^^ |// |//
- //| //| | | | | | | ^^ |// |//
- //| //| | 0.125 0.375 0.625 0.875 | ^^ |// |//
- //| //| | | ^^ |// |//
- //| //| 0<--WEBGL_MAPPED_RANGE_0_TO_1-->1 ^^ |// |//
- //| //| ^^ |// |//
- //| //| [ TILE_COORDINATES >>>^^] |// |//
- //| //| (If each pixel encodes ) |// |//
- //| //| (a tile value on tilemap) |// |//
- //| //| |// |//
- //| //|/////////////////:DIAGRAM[SC[DIA_TILTEX]]:|// |//
- //| |//
- //| Solving in a more detailed manner yeilds a more |//
- //| complex formula... But the results are almost |//
- //| identical. And identical enough for what I need. |//
- //| |//
- //| +---+---+---+---+---+---+ |//
- //| | | | | |//
- //| + 0 + 1 + 2 + |//
- //| | | | | |//
- //| +---+---+---+---+---+---+ |//
- //| ^ ~.16~ 0.5 .83 ^ |//
- //| | | |//
- //| | | |//
- //| | | |//
- //| 0<-------- 0-1 -------->1 |//
- //| |//
- //| 1: Figure how many half segments there are: |//
- //| var num_seg = ( wid * 2 ); |//
- //| |//
- //| 2: Get the length of a single half segment |//
- //| as portion of normalized length: |//
- //| var nom_seg = ( 1 / num_seg ); |//
- //| |//
- //| 3: First pixel center is one nom_seg from zero. |//
- //| Each succesive coordinate is 2 more nom_seg. |//
- //| |//
- //| //:til_cor: Tile Coordinate |//
- //| //:til_tex: Tile texture/normalized position. |//
- //| til_nom = (nom_seg*1) + ( til_cor * ( nom_seg * 2 ) ) |//
- //| |//
- //| ((1/(wid*2))*1)+(til*((1/(wid*2))*2)) |//
- //| //:::wid:::::::::til::::::wid:::::::: |//
- //| |//
- //| |//
- //| wid:3 til:0 ((1/( 3 *2))*1)+( 0 *((1/( 3 *2))*2)) |//
- //| wid:3 til:1 ((1/( 3 *2))*1)+( 1 *((1/( 3 *2))*2)) |//
- //| wid:3 til:2 ((1/( 3 *2))*1)+( 2 *((1/( 3 *2))*2)) |//
- //| |//
- //| [ FORMULA:01 / fom_001 ] |//
- //| ((1/(wid*2))*1)+(til*((1/(wid*2))*2)) |//
- //| |//
- //| [ FORMULA:02 / fom_002 ] |//
- //| ( til + 0.5 ) / ( wid ) |//
- //| |//
- //| |//
- //|/////////////////////////:DIAGRAM[SC[DIA_TILTEX_ULTRA]]///|//
- var pep_tim=( 0 ); //:PerfectPassTimes
- var pas_tim=( 0 ); //:PassTimes
- var fai_tim=( 0 ); //:FailTimes
- for( var wid = 0; wid < 1024; wid++ ){
- for( var til = 0; til <= (wid-1); til++ ){
- //:Run formulas( fom ) 001 & 002:
- fom_001 = ((1/(wid*2))*1)+(til*((1/(wid*2))*2));
- fom_002 = ( til + 0.5 ) / ( wid ) ;
- //:formula delta:
- var fom_del = Math.abs( fom_001 - fom_002 );
- //:max delta... 16 degrees of freedom in a single
- //:tile when using 1024 tiles seems fine:
- var max_del =( 1 / 1024 / 16 );
- if( fom_del > max_del ){
- throw("[Formulas_Are_Not_The_Same]");
- fai_tim++; //:fail times.
- }else{
- if( 0 == fom_del ){
- pep_tim++; //:PerfectPassTimes.
- }else{
- pas_tim++; //:pass times.
- };;
- };;
- };;};;
- console.log( "[fai_tim]:", fai_tim );
- console.log( "[pas_tim]:", pas_tim );
- console.log( "[pep_tim]:", pep_tim );
Add Comment
Please, Sign In to add comment