Moving segments of a line.

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

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.
		if(bluedot1_down)
{
angle=(float)atan2((double)d_mousePos.y-movPos.y,(double)d_mousePos.x-movPos.x)* 57.29f+90;
}
if(reddot_down)
{
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.

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 15
• 13
• 9
• 12
• 10
• Forum Statistics

• Total Topics
631442
• Total Posts
3000089
×