Học Actionscript 3.0 - p 20

Geometry and Trigonometry Geometry and Trigonometry Although many people find geometry and trigonometry intimidating, the small investment required to understand a few basic principles in these disciplines can pay large dividends. For example, what if you needed to find the distance between two points, or rotate one object around another? These small tasks are needed more often than you may think, and are easier to accomplish than you may realize. Movement Along an Angle Earlier we discussed velocity as a vector quantity because it combined magnitude and direction. However, the direction in the previous example was determined by changing x and y coordinates. Unfortunately,. | Geometry and Trigonometry Geometry and Trigonometry Although many people find geometry and trigonometry intimidating the small investment required to understand a few basic principles in these disciplines can pay large dividends. For example what if you needed to find the distance between two points or rotate one object around another These small tasks are needed more often than you may think and are easier to accomplish than you may realize. Movement Along an Angle Earlier we discussed velocity as a vector quantity because it combined magnitude and direction. However the direction in the previous example was determined by changing x and y coordinates. Unfortunately such a direction is easily identifiable only when moving along simple paths such as along the x or y axis. A much better way to indicate a direction is to specify an angle to follow. Before we discuss angles and their different units of measure you need to understand how angles are indicated in the ActionScript coordinate system. As you might expect angles are commonly referenced using degrees but it s important to note that 0 degrees is along the x axis pointing to the right. The 360-degree circle then unfolds clockwise around the coordinate system. This means 90 degrees points down along the y axis 180 degrees points left along the x axis and so on as shown in Figure 7-10. Now that you have a correct point of reference the next important concept to understand is that most of ActionScript like most computer languages and mathematicians does not use degrees as its preferred unit of measurement for angles. This is true for just about all common uses of angles except for the rotation property of display objects and one or two more obscure items also related to rotation. Predominately ActionScript uses radians as the unit of measure for angles. A radian is the angle defined by moving along the outside of the circle only for a distance as long as the circle s radius as seen in Figure 7-4. One radian is 180

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
127    91    6    29-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.