61
Graphics / Re: Do these three features exist?
« on: March 25, 2020, 01:49:49 am »An easy way to do this is with a matrix:
let's say you have a center of rotation, C, and an angle of rotation, A.
your shape is made of a bunch of little shapes - you can just apply this transformation to each one.
let's say your shape's vertices are {(x,y), (x1, y1), (x2,y2)}
create a new shape with vertices at {(x-C, y-C), (x1-C, y1-C), (x2-C, y2-C)}
apply the 2D rotation matrix (oh boy how do I format this):
[cos(A) -sin(A)]
[sin(A) cos(A)]
to each one of the new shape's vertices and then just add C back to each one.
Apply this to every one of your shapes and they will rotate exactly!
Hello, sorry i am trying to use this only today (i have been busy),
Whay do you mean by the 2D rotation matrix?
Yoo described three vertices and then showed a matrix containing 4 operations,
I see on the documentation : https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Transformable.php
only one 2 rotation functions : setRotation (float angle) and rotate (float angle), both have only one argument. Could you expand please?
If anyone has the answer, feel free.. since A_Sentient_Tomato is nota regular user he might not see this.
(Remember i know some math but mostly i am a free c++ learner.)