Jump to content
  • Advertisement
Sign in to follow this  

Moving segments of a line.

This topic is 3205 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have a line made of segments. Here's a pic (I forgot the end dot on the first line) http://img709.imageshack.us/img709/5228/71276566.jpg So it'll start off as a straight line and when the user moves the red dot with the mouse the entire line moves, and when the user rotates a blue dot, all the segments ahead of it and the one behind it will rotate on the dot 1 down in the line. How can I do this? I'm using Direct2D but it shouldn't be too hard to explain even if you haven't used it. So far I have one segment, this is what I've got so far.
			angle=(float)atan2((double)d_mousePos.y-movPos.y,(double)d_mousePos.x-movPos.x)* 57.29f+90;
			movPos.x = (long)d_mousePos.x;
			movPos.y = (long)d_mousePos.y;
	rotation = D2D1::Matrix3x2F::Rotation(angle, D2D1::Point2F(250.0f, 200.0f));
	translation = D2D1::Matrix3x2F::Translation((float)movPos.x-250, (float)movPos.y-200);
	RT->SetTransform(rotation* translation);
	RT->DrawLine(D2D1::Point2F(250, 200),D2D1::Point2F(250, 140),Black, 8, StrokeStyle);
	RT->DrawLine(D2D1::Point2F(250, 140),D2D1::Point2F(280, 170),Black, 8, StrokeStyle);

	RT->FillGeometry(bluedot1, Red);
	RT->FillGeometry(reddot, Orange);

I'm new to transformations so I'm kinda stuck on what comes next.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!