Jump to content

- - - - -

(x,y) Coordinate mapping


  • Please log in to reply
61 replies to this topic

#1
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

So... anyone with prior and current knowledge in 3d LBP map making knows that you need 2 rooms. One where the room tracks the players movements, and one where the player tracks the movement of the room. The second room being the one that's seen.

 

A large bottleneck has been getting linear x and y signals, and transferring them over to movers in the next room. But Tags in the game aren't linear, they're radial. So creators have gotten around this by placing the tags and tag sensors far atop and to the side of their rooms. Such distance decreases the roundness of zone, but only slightly. 

The problem occurs with when the moving room turns against a level border, and its attached tag/sensor exits the levels boundary... thus breaking it and the whole build.

 

I've thought long and hard about an easy alternative... and have come to a remarkable conclusion: Trig!

 

With trig, I can input the distance the player is from a point (origin), along with the angle the player is from it in radians, and calculate the x and y. I can do this thanks to the functions Sine and Cosine. Which I can indeed compute in the game (Only LBP2 since values exceed 100%).

 

I can now determine the players exact (by 6 decimals) position in the x and y planes with just a little swivel object that constantly points at the player (determines angle and distance). No outward tags and sensors. Just beautiful math!

 

 

Now, I know I said I wouldn't be here or on LBP for a while, but I had to let some people know about this.

Sadly, it is LBP2 only, since the numb-nuts over at Sumo took away signals that exceed 100%.


  • EnochRoot, leloDeextuppy, Danielot and 18 others like this

#2
mirjanneke

mirjanneke

    Mir :)

  • Honoured Sacks
  • 2,147 posts
  • LocationCraftworld

 

 

Now, I know I said I wouldn't be here or on LBP for a while, but I had to let some people know about this.

.

hey, you're always welcome here :)


   4rRvglp.png

Happy gaming 2 U :)


#3
Yonderland

Yonderland

    hi

  • Sack Stars
  • 1,264 posts

Glad you're back.... For now.  :Evillaugh:



44112.png


 


#4
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly
I wish I could make this contraption LBP3 compatible. But the microchips I have that calculate the sine and cosine of the data require whole numbers.
Maybe if a petition or something was made up to let Sumo know that some things aren't bugs at all, but opportunities (layer glitch for example).
Seeing as how that's a slim chance, it seems it will continue to be a LBP2 exclusive. Which sucks. :ascared:

#5
katanagirl1

katanagirl1

    Royal Sack

  • Honoured Sacks
  • 1,984 posts
  • LocationPhoenix, AZ, USA
The title of the thread caught my eye. I'm trying to visualize the setup you are describing, since obviously I haven't done that. Maybe something with spherical coordinates would work? I admit I haven't gotten much use from angle sensors so far though, very disappointing. You've planted a seed and if I don't get sidetracked by something else, I'm sure that will simmer on the back burner of my mind!
Posted Image

#6
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

Here was the process and setup:

 

I knew that in order to get the length of the legs of a right triangle, I needed the length of the hypotenuse, as well as its angle.

 

hypotenuse.png

 

I have a simple tag and tag sensor setup to find the length, but the angle was tricky.

I had to create an entire system which outputted object orientation in accurate degrees. And then convert that data into radians by multiplying it by pi, and then by 0.0055556. ( Basically, multiplying by pi/180 )

 

Now that I had hypotenuse length and the angle in radians, I could plug the data into either trig function chips I made: Sine and Cosine, and find the other leg using Pythagoreans theorem. 

 

The outputted analog signals were in the same units that tag sensors use. So movers and other sensors can interpret the data directly.

 

~Plugging the x and y data into a memorizer could save the location of any item/player in a level. 

~Plugging it into a 3D rotation room can make the most accurate alternative to tags in existence.

~More ideas.


  • katanagirl1 likes this

#7
katanagirl1

katanagirl1

    Royal Sack

  • Honoured Sacks
  • 1,984 posts
  • LocationPhoenix, AZ, USA

I'm impressed with the fact that you guys can do such math with LBP logic!  I dusted off my calculus book and looked up some things.  I guess going to spherical or cylindrical coordinates will not help if the problem is with the sine and cosine functions.  I guess I'm a bit confused as to why you would want them to exceed 1, and I am thinking radians instead of degrees.  That is not how trig functions work, from what I remember - definitely not the sine and cosine because they are defined on the unit circle.  You do special things to accommodate arctangent functions (inverse tangent) so you get things into the correct quadrant in programming (atan vs atan2).  I am assuming that all your z values are positive, atan is defined over -pi/2 to pi/2 and you use atan2 which is defined over -pi to pi.  I had to dust off my FORTRAN book for that one!  So, forgive me if I'm boring everyone, but why do you need a logic output greater than 1 to do what you just described above?


Posted Image

#8
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

Ugh... I was tired and you made my brain hurt... okay... here we go:

 

The problem arrises with the calculation of Sine and/or Cosine.

Cosine is achieved by merely subtracting the angle from "π/2" (90°), and calculating with Sine.

So all I really needed was a Sine chip. I achieved this by taking advantage of the Taylor Series for:

 

sin (x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! +...
 

"x" is obviously the angle, and it's required to be in radian form. As you can probably guess, altering a radian to be below 100% would alter the output (decimal shift, in-formula implant, etc.).

There's just no room for altering it's value to satisfy LBP3's silly cap.

 

Unless your book mentions a way of calculating sine of an altered value, and then un-altering it into the correct output.


  • katanagirl1 likes this

#9
mirjanneke

mirjanneke

    Mir :)

  • Honoured Sacks
  • 2,147 posts
  • LocationCraftworld

wow, now my brain hurts :OMGZ!:


  • katanagirl1 likes this

   4rRvglp.png

Happy gaming 2 U :)


#10
Tynz21

Tynz21

    Hot Shot Sack

  • Members
  • PipPipPip
  • 164 posts
  • Locationright here, right now
so does lbp3 not take signals greater than 100% any longer? Because the beta did, I specifically remember manipulating and graphing the signals of the tan, cot, sec, and csc functions signal vs time, all of Which go off to infinity or negative infinity as they approach their asymptotes.

I'm trying to reason out this issue as I sit at lunch Before chemistry, so I'm excuse potentially irrelevant thoughts but.

Sinx = x-x^3/3!+x^5/5!-x^7/7!...
so
Sin(x-B) = (x-B)-(x-B)^3/3!+(x-B)^5/5!+(x-B)^7/7!
Note: this is still the maclaurin series about a = 0 rewritten with the input x as (x-B)
From there you can say:
Sin(x-B) = (x-B) - (x^3-3x^2b+3xb^2+b^3)/3!...
and so on, expanding out your polynomials...
I guess that only helps if you know what to expect for sin x because then you can get a rough differential for sinx - sin (x-B) but then you'd have to program every differential in individually, Which is totally not a good solution... There's gotta be a way to generalize it though...
although allowing excessive analog signals is the game and easily accessible would be so much nicer.

#11
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

so does lbp3 not take signals greater than 100% any longer? Because the beta did, I specifically remember manipulating and graphing the signals of the tan, cot, sec, and csc functions signal vs time, all of Which go off to infinity or negative infinity as they approach their asymptotes.

I'm trying to reason out this issue as I sit at lunch Before chemistry, so I'm excuse potentially irrelevant thoughts but.

Sinx = x-x^3/3!+x^5/5!-x^7/7!...
so
Sin(x- B) = (x- B)-(x- B)^3/3!+(x- B)^5/5!+(x- B)^7/7!
Note: this is still the maclaurin series about a = 0 rewritten with the input x as (x- B)
From there you can say:
Sin(x- B) = (x- B) - (x^3-3x^2b+3xb^2+b^3)/3!...
and so on, expanding out your polynomials...
I guess that only helps if you know what to expect for sin x because then you can get a rough differential for sinx - sin (x- B) but then you'd have to program every differential in individually, Which is totally not a good solution... There's gotta be a way to generalize it though...
although allowing excessive analog signals is the game and easily accessible would be so much nicer.

 

That's what I meant by "in-formula implant".

Injecting the formula with an altered value still leaves the alteration within the function of Sine: Sin(x- B)). 

 

If LBP3 didn't have that restriction, there'd be no problem!



#12
katanagirl1

katanagirl1

    Royal Sack

  • Honoured Sacks
  • 1,984 posts
  • LocationPhoenix, AZ, USA

Ugh... I was tired and you made my brain hurt... okay... here we go:

 

The problem arrises with the calculation of Sine and/or Cosine.

Cosine is achieved by merely subtracting the angle from "π/2" (90°), and calculating with Sine.

So all I really needed was a Sine chip. I achieved this by taking advantage of the Taylor Series for:

 

sin (x) = x - (x^3)/3! + (x^5)/5! - (x^7)/7! +...
 

"x" is obviously the angle, and it's required to be in radian form. As you can probably guess, altering a radian to be below 100% would alter the output (decimal shift, in-formula shift implant, etc.).

There's just no room for altering it's value to satisfy LBP3's silly cap.

 

Unless your book mentions a way of calculating sine of an altered value, and then un-altering it into the correct output.

 

Alright, now we're getting to the heart of it!  So, you don't want to force the radian value to be less than one, that would be incorrect.  I will have to look in the game and see if I can find a sine chip.  I cannot even fathom how you are doing this will LBP logic - multiplication and powers and such.  I have not delved into logic this seriously before.  The only thing I can think of at the moment is we now have a waveform generator, and that might be useful for stuff such as this.  I assume the output is 0 to 1 as well, though.


  • Tynz21 likes this
Posted Image

#13
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

Alright, now we're getting to the heart of it!  So, you don't want to force the radian value to be less than one, that would be incorrect.  I will have to look in the game and see if I can find a sine chip.  I cannot even fathom how you are doing this will LBP logic - multiplication and powers and such.  I have not delved into logic this seriously before.  The only thing I can think of at the moment is we now have a waveform generator, and that might be useful for stuff such as this.  I assume the output is 0 to 1 as well, though.

 
The Sine chip I made diverges once the inputted value is above π:
 

300px-Taylorsine.svg.png


But just "π/2" (90°) is 1.570796327... which is greater than 1!

You can also rid the divergence by simply shifting the curve left or right.

 

In LBP2, the 3D room I made works so beautifully. With this Sine chip, it feels almost as if LBP2 was made to work with 3D.



#14
katanagirl1

katanagirl1

    Royal Sack

  • Honoured Sacks
  • 1,984 posts
  • LocationPhoenix, AZ, USA

 
The Sine chip I made diverges once the inputted value is above π:
 

300px-Taylorsine.svg.png


But just "π/2" (90°) is 1.570796327... which is greater than 1!

You can also rid the divergence by simply shifting the curve left or right.

 

In LBP2, the 3D room I made works so beautifully. With this Sine chip, it feels almost as if LBP2 was made to work with 3D.

 

I did a quick search for stuff like this on the Internet and found a post from a guy... oh look!  He has the same username as you!  Something about square and cube root chips   :)

 

I understand the math behind all this, but I'm still struggling to see how to represent a real number using logic in LBP.  The value of sin(x) and cos(x) are constrained to be within [-1,1] but the value x is not, that is the issue.  You certainly know what you are doing, maybe I can figure it out someday! 

 

This is what I love about LBP - I'm sure the original creators never dreamed of anyone using the game to do stuff such as this.  There are a lot of people out there really pushing the boundaries of what can be done!

 
 *bows before you*

Posted Image

#15
Tynz21

Tynz21

    Hot Shot Sack

  • Members
  • PipPipPip
  • 164 posts
  • Locationright here, right now
for the curious party, It's easy enough to program in multiplication and powers and such, multiplication and addition of inputs are built and and or gates. First the purpose of raising to a power, You'd just take your multiplication gate and plug in what you want to raised to a power that many times. X^3 you would plug your signal into all ports with a 3 port gate, and so on. Factorials (x!) Are just 1*(2)*(3)*...(n-1)*(n). So you just do those with multiplication. And from these elementary operations given we can construct more and more operations with the help from Taylor series definitions and such, Which is the whole thing:
Sinx = x-x^3/3!+x^5/5!...

There exist these definitions for basically every function could need, some with limitations on inputs that work though.
For example
1/1-x = x+x^2+x^3... but only for |x|< 1 I believe it is.
  • Bonnell7 likes this

#16
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

I understand the math behind all this, but I'm still struggling to see how to represent a real number using logic in LBP.

 
 
LBP logic works based on analog signal strengths via percentages. Any percent can be represented outside percent context as a decimal.
So 30% turns to 0.3.
All we need to do to get the real number 3 is produce 300%. Something LBP3 can't do. 
So 5! would be: 100% x 200% x 300% x 400% x 500%
LBP3 can't make it past the first step of that function.
 
 

For the curious party, It's easy enough to program in multiplication and powers and such, multiplication and addition of inputs are built and and or gates. First the purpose of raising to a power, You'd just take your multiplication gate and plug in what you want to raised to a power that many times. X^3 you would plug your signal into all ports with a 3 port gate, and so on. Factorials (x!) Are just 1*(2)*(3)*...(n-1)*(n). So you just do those with multiplication. And from these elementary operations given we can construct more and more operations with the help from Taylor series and such.

 

Exactly. Nearly any function can be broken down into elementary parts, and calculated to reach an approximation, given the number of steps (n) a person or computer is willing to work to, of course.

 

But as you can see in that graph of an actual Sine wave versus the Taylor approximation, his method diverges the closer you get to its limit.

Some Taylor Series (such as the Sine one) can be altered and fixed by merely shifting the values to the side.

But others, such as the 1/1-x series, have no fix to their divergence.   :(



#17
Tynz21

Tynz21

    Hot Shot Sack

  • Members
  • PipPipPip
  • 164 posts
  • Locationright here, right now
The maclaurin/Taylor series sine function actually converges for all values of x, you just need more terms. The total sum of the infinite series is exactly equal to the sine function for all values of x.

This is also true of cos and e^x. In fact, with the Taylor series for these, the derivation of the formula
cosx + isinx = e^x
and from there
e^iπ = -1
which is everyone's favorite equation!

#18
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly

The maclaurin/Taylor series sine function actually converges for all values of x, you just need more terms. The total sum of the infinite series is exactly equal to the sine function for all values of x.

 

I don't agree. The Taylor series is an approximation even at its infinite point of sum. The only point at which it is 100% accurate is at x=0. Just punch in "4π" (720°) for x in sin(x).

 

sin(4π) = 0.217570395...

Taylor sin(4π) = -1.309531794E-12    at term: "(4π^23)/23!".   The output continues to go further negative, not even remotely getting close to its target. This is represented in that graph I showed above of the Taylor Sine Divergence. Imagine where "4π" is on y=0. Now imagine where the pink line is directly underneath that point. It's "y" coord is WAAAYYY off.

 

300px-Taylorsine.svg.png

 

The ONLY way to solve this problem is by shifting your value "x" by subtracting, or adding n(2π) to it, plugging it in, then shifting it back.

If you think that might be the solution to the 100% cap though, you're wrong. Just 1π is 3.14159..., that's already more than LBP3 can handle.



#19
Tynz21

Tynz21

    Hot Shot Sack

  • Members
  • PipPipPip
  • 164 posts
  • Locationright here, right now

I don't agree. The Taylor series is an approximation even at its infinite point of sum. The only point at which it is 100% accurate is at x=0. Just punch in "4π" (720°) for x in sin(x).

sin(4π) = 0.217570395...
Taylor sin(4π) = -1.309531794E-12 at term: "(4π^23)/23!". The output continues to go further negative, not even remotely getting close to its target. This is represented in that graph I showed above of the Taylor Sine Divergence. Imagine where "4π" is on y=0. Now imagine where the pink line is directly underneath that point. It's "y" coord is WAAAYYY off.






300px-Taylorsine.svg.png


The ONLY way to solve this problem is by shifting your value "x" by subtracting, or adding n(2π) to it, plugging it in, then shifting it back.
If you think that might be the solution to the 100% cap though, you're wrong. Just 1π is 3.14159..., that's already more than LBP3 can handle.
I'm not saying it's practical but That's what this taylor series is, a polynomial representation of the sine function. As you increase the degree of a polynomial so to does the amount of inversions it can have. At n = ∞ there are an infinite number of inversions in the Taylor polynomial resulting from the maclaurin series definition of the sine function. The total sum of the infinite series is defined as it's limit as n goes to infinity. If you look online you can find successive graphs of higher degree Taylor polynomials and what they cover I'm sure, but even to 12 terms you could easily still need substantially more. If the first 4 terms or whatever were represented by the graph you posted, 12 terms would then logically only cover till about 3π with and degree of accuracy.

Here maybe this graph will help. It shows Taylor polynomials from degree 1 (1 term) to degree 13 (7 terms) and how they approach the sine function. As the degree n goes to infinity, the graph of the Taylor polynomial goes to the value of the sine function for all real numbers x.

Attached File  300px-Sintay_SVG.svg (1).png   22.54KB   0 downloads


Bear in mind though that this still isn't a solution because it still doesn't help at all in terms of staying under 1.00... but I just want to be clear.

Also, by the way, sin(4π) is the same as sin(0). Which is 0. Your calculator is in degree mode lol.
  • Bonnell7 likes this

#20
Bonnell7

Bonnell7

    The Logic Ion

  • Happy Sacks
  • 782 posts
  • Locationis otherworldly
Oh, I see.

But yeah, still not a solution.
  • Tynz21 likes this




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


IPB skins by Skinbox