Small Basic: Rotate Triangle and Line
Once I wrote an article about how to rotate Shapes not from the center on TechNet Wiki. And that article was featured on this blog. That article was for Rectangle and Ellipse.
Today I will introduce about rotation for Triangle and Line.
Rectangle and Ellipse are rotated from their center. But Triangle and Line are not always rotated from their center. I wrote an article about Rotation Centers for Shapes of Triangle and Line. For example, a triangle created with Shapes.AddTriangle(50, 150, 150, 50, 150, 150) has its rotation center out of the shape.
But the logic to determine the center for Triangle and Line is different between local and remote. In remote, the center is always it's origin in definition co-ordinate. Details about this know issue is described here.
Another Way to Rotate Shapes Not from the Center
From the special logic for triangle and line to determine the rotation center and the known issue in remote, I found a good way to rotate Shapes not from the center. The way is especially for Line. For example a line defined as Shapes.AddLine(0, 0, 0, -100) is rotated from the origin (one end point of the line ) in definition co-ordinate of the line. And this way is available both for in local and in remote. This may be a simple way to create clock hands. You can try to rotate line with a sample program KSL776. Click two end points with this program. You can select next points after the rotation.