how do image points work?

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Tue Aug 11, 2009 3:24 pm

not how do I implement them, but if I want to get a location
basically a location I could either get from trigonometric functions
or by creating a sprite with an imagepoint, rotating it, and getting the imagepoint

is it quicker to get an imagepoint of a sprite, because of some vram sprite rotation thing?
or is it just calculating an offset of the sprites hotspot using sin and cosine and such?
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Aug 11, 2009 8:15 pm

Um, I don't really understand what you mean, but the GetImagePoint function factors in scaling and rotation for you. Image points aren't stored in VRAM, they're stored in system memory, so the function to retrieve it is fast.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Tue Aug 11, 2009 9:21 pm

I just mean,
imagine creating a function to create and retrieve imagepoints
you would store an x and y offset value, and then on retrieval and then use something like trigonometric functions to calculate the current location of the imagepoint

I'm trying to find out if that's how they work in construct, or does construct use some kindof special feature of sprites to retrieve the location of the imagepoint pixel or something

basically to figure out if I would save any time by using actual image points or by using the aforementioned trigonometric functions. in this instance, I would be creating a sprite just for the sake of using the quicker imagepoint retrieval if that was the case. the sprite wouldn't be needed otherwise.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Aug 11, 2009 9:34 pm

You can kind of do that already with distortmaps get vertex x, and y... within the limitations of distormap that is.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Aug 11, 2009 9:57 pm

Construct uses the trig math method. There's no other reasonable way! If you thought the graphics card could do this, just sending the message from the CPU to the GPU instructing it to perform the calculation would take longer than just doing the sum anyway, so I think you're misleading yourself. It can't really be done any other way!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Aug 12, 2009 11:56 pm

I think image points already use trigonometric functions to determine the current image point x and y for a sprite, in its position, with its rotation. There's not other way in the world. And it makes no sense using trigonometric function instead of image points that use them (anyway when I didn't know about image points, I used sin and cos).
B
2
S
1
G
3
Posts: 193
Reputation: 1,486

Post » Thu Aug 13, 2009 5:17 pm

Genesys: Of course sin and cos are used. Lucid just wanted to know if there counstruct was using some GPU-optimised method with image points, as he wanted to optimise his own code for speed.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests