Hello,

I have got an square image with a point specified by the user(not neccessary to be in the centre).
I want my program to draw a line or vector from that point to the boundary of the image.
Then, I want to draw the same vector again and again in a circular motion until reaching the first vector again.
So, to make it more clear, I want these vectors to be drawn equally spaced from each other.
So, I thought about applying rotation on the first vector. say, for example, for every 10 degrees draw a vector.

So at the end i want to have a center point with vectors around it drawn in equally space.

How can I apply this in C++ ?
is there a better way to do this this other than rotation and angles?

I will really appreciate your help.
hope you can help me as soon as possible.

Thanks.
Jowana .

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Stefano Mtangoo

The question is really do you know how to draw stuff in a c++ program and want help with the maths for making a 36 pointed star shape [10 degrees]. Or do you want help writing a C++ program to draw stuff.

If it is the maths, then the obvious way to do it is to note thThe question is really do you know how to draw stuff in a c++ program and want help with the maths for making a 36 pointed star shape [10 degrees]. Or do you want help writing a C++ program to draw stuff.

If it is the maths, then the obvious way to do it is to note that the unit vector constructed with the coordinates $$\cos(\theta), \sin(\theta)$$ and iterate through the angle from 0 to 360 degree (0 to 2*PI radians: C++ cos /sin functions are in radians!) and draw the appropriate line to the edge of the square.

So show us your basic code, and we will help a bit.

my main problem is that i dont know how to program this. I have a good background in graphis But, i dont have much experience in coding it.
your explanation made it clearer for me now. But, how can i draw the lines?
i should draw a line first and then draw a line after each iteration.

Can you give me like hints or examples please?, I want to try coding it by myself but dont know how to start.