English Amiga Board A different way to rotate a point?
 User Name Remember Me? Password
 Register Amiga FAQ Rules & Help Members List  /  Moderators List Today's Posts Mark Forums Read

 27 December 2018, 14:01 #1 LaBodilsen Registered User   Join Date: Dec 2017 Location: Gandrup / Denmark Posts: 91 A different way to rotate a point? I don't know if this have been done before, but i've been pondering on this for a little while, and i think the idea came from a dot sphere in some demo. As i was watching this sphere, it came to me that every dot in this sphere could be described as an angle and distance from center, instead of a coordinate in a 3d world. So what if we used this as a coordinate system where we describe each point as an angle and distance from center, eg 45,50 is angle = 45 and distance from center is 50. Then to rotate that point we could simply add the rotation angle to the initial angle, and voila be done with it. To convert this angle,distance coodinate to screen space, we would derive the X coordinate with Sin(angle)*Distance, and the Y Coordinate with Cos(angle)*Distance. example: Coord: 22,50 X = Sin(22)*50 = 18,73 Y = Cos(22)*50 = 46,35 So the coord 22,50 would translate to X,Y coord (18,73),(46,35). To rotate the point by 30 degree, we add that to the initial coord and get: Coord: 52,50 X = Sin(52)*50 = 39,40 Y = Cos(52)*50 = 30,78 With this we can get a rotate loop without any multiplication, and only use addition. I tried this out in assembler yesterday, and the code becomes very simple: Code: ``` lea Plots,A0 ;list of Angle coords lea SinTable,A1 ;Sintable start lea CosTable,A2 ;Costable start move.w RotAngle,D5 .Rotate_Loop move.w (A0)+,D2 ;Coord Angle add.w D5,D2 ;Add rotation angle to angle coord and.w #2047,D2 ;Limit to Sin/Costable size .Convert_To_ScreenCoords move.w (A0)+,D0 ;Coord Distance move.w D0,D1 muls (A1,D2),D0 ;Convert X coord muls (A2,D2),D1 ;Convert Y coord``` This is ofcourse only a 2D rotation, but i don't think expanding this to 3D would add that much complexity, eg expand the coord to (AngleZ,AngleX,AngleY,Distance) and convert that to screenspace. But creating objects in this angle,distance system might be pretty hard, but not impossible. Maybe a converter would be the best way. So have this been done before?, and/or was it trashed for some reason. Any thoughts would be appreciated. Last edited by LaBodilsen; 27 December 2018 at 14:20.
 27 December 2018, 14:21 #2 hooverphonique ex. demoscener "Bigmama"   Join Date: Jun 2012 Location: Fyn / Denmark Posts: 1,045 I have been thinking of this before as well.. Basically, you describe your model in polar coordinates, and then transform to cartesian for projection/rendering. I can't remember if I used this for any demoscene-related stuff myself though..
 27 December 2018, 14:24 #3 thomas Registered User   Join Date: Jan 2002 Location: Germany Posts: 5,922 It's called the polar coordinate system. Yes, rotating becomes very easy. But scaling and/or moving objects will become quite difficult, especially if the direction of movement is not towards or away from the center point.
27 December 2018, 14:47   #4
LaBodilsen
Registered User

Join Date: Dec 2017
Location: Gandrup / Denmark
Posts: 91
Quote:
 Originally Posted by thomas It's called the polar coordinate system. Yes, rotating becomes very easy. But scaling and/or moving objects will become quite difficult, especially if the direction of movement is not towards or away from the center point.
Doh... It seems i discovered what is known to the educated man as the Polar coordinate system.

Well thank you for the pointer, it will properly make it easier to get a better understanding of it, now that i know that a greek astronomer and astrologer figured this out 2200 years ago.

 28 December 2018, 00:53 #5 Codetapper 2 contact me: email only!   Join Date: May 2001 Location: Auckland / New Zealand Posts: 3,162 The first time I'd heard of this was Andrew Braybrook's diary of a game for C64 Morpheus in 1987.
 07 January 2019, 13:51 #6 nonamehjb   Posts: n/a Fastjack used polar coordinates in his bump-mapped ball from [ Show youtube player ] and Mnemonics. And I think also Mr. Pet used it in [ Show youtube player ] to rotate the dots.
 07 January 2019, 14:58 #7 grond Registered User   Join Date: Jun 2015 Location: Germany Posts: 701 There are lots of demos that use spherical coordinates for faster projection. You can usually see it because movement is restricted. You can fake a lot, e.g. project using table lookups and then just scale linearly to achieve the impression of varying distance. You can use perspectively incorrect direct projection. You can use a base vector for an object, project that correctly and then just project difference vectors from the base vector using smaller tables. You can use logarithmic tables to replace muls and divs by adds and subs. All of these techniques have the problem that they are imprecise, visually incorrect and don't allow for random movement. They can be made to look good in a demo where you have everything under control but would hardly work well in games where the player decides the movement. E.g. the bump mapped bouncing ball from the above linked demo probably just uses some vertical linear stretching to achieve the bumping effect. How could you tell watching the demo that the angle of incident light is not changed correctly with the "deformation" of the ball? Demos are about faking something much more complex and that's the fun in them.

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Similar Threads Thread Thread Starter Forum Replies Last Post peceha Coders. Blitz Basic 6 23 April 2018 23:18 Sim085 support.WinUAE 3 11 April 2017 20:43 Mounty project.WHDLoad 7 25 January 2013 00:18 Dunny support.Demos 7 06 August 2012 10:04 backtoskooldaze support.Hardware 1 06 April 2002 07:27

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News Main     Amiga scene     Retrogaming General Discussion     Nostalgia & memories Support     New to Emulation or Amiga scene         Member Introductions     support.WinUAE     support.WinFellow     support.OtherUAE     support.FS-UAE         project.AmigaLive     support.Hardware         Hardware mods         Hardware pics     support.Games     support.Demos     support.Apps     support.Amiga Forever     support.Amix     support.Other Requests     request.UAE Wishlist     request.Old Rare Games     request.Demos     request.Apps     request.Modules     request.Music     request.Other     Looking for a game name ?     Games images which need to be WHDified abime.net - Hall Of Light     HOL news     HOL suggestions and feedback     HOL data problems     HOL contributions abime.net - Amiga Magazine Rack     AMR news     AMR suggestions and feedback     AMR data problems     AMR contributions abime.net - Home Projects     project.Amiga Lore     project.EAB     project.IRC     project.Mods Jukebox     project.Wiki abime.net - Hosted Projects     project.aGTW     project.APoV     project.ClassicWB     project.Jambo!     project.Green Amiga Alien GUIDES     project.Maptapper     project.Sprites     project.WinUAE - Kaillera Other Projects     project.Amiga Demo DVD     project.Amiga Game Factory     project.CARE     project.EAB File Server     project.CD32 Conversion     project.Game Cover Art         GCA.Feedback and Suggestions         GCA.Work in Progress         GCA.Cover Requests         GCA.Usefull Programs         GCA.Helpdesk     project.KGLoad     project.MAGE     project.Missing Full Shareware Games     project.SPS (was CAPS)     project.TOSEC (amiga only)     project.WHDLoad         project.Killergorilla's WHD packs Misc     Amiga websites reviews     MarketPlace         Swapshop     Kinky Amiga Stuff     Collections     EAB's competition Coders     Coders. General         Coders. Releases         Coders. Tutorials     Coders. Asm / Hardware     Coders. System         Coders. Scripting         Coders. Nextgen     Coders. Language         Coders. C/C++         Coders. AMOS         Coders. Blitz Basic     Coders. Contest         Coders. Entries Creation     Graphics         Graphics. Work In Progress         Graphics. Finished Work         Graphics. Tutorials     Music         Music. Work In Progress         Music. Finished Work         Music. Tutorials Off Topic     OT - General     OT - Entertainment     OT - Sports     OT - Technical     OT - Gaming

All times are GMT +2. The time now is 03:06.

 -- EAB3 skin ---- EAB2 skin ---- Mobile skin Archive - Top