TAILIEUCHUNG - CRC.Press A Guide to MATLAB Object Oriented Programming May.2007 Episode 1 Part 9

Tham khảo tài liệu ' a guide to matlab object oriented programming episode 1 part 9', kỹ thuật - công nghệ, cơ khí - chế tạo máy phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 134 A Guide to MATLAB Object-Oriented Programming FIGURE Default graphic for cShape object. shape cShape shape draw shape draws the figure shown in Figure . When the size and scale factors change pay close attention to the axes. We are allowing MATLAB to scale the plot automatically. We could improve on that situation by designing in another set of scale-related member variables and functions. For this test drive automatic scaling is okay. Change the color to red using either 1 0 0 or shape set shape ColorRgb 1 0 0 Clients should usually use dot-reference syntax vs. set but the result from either is the same. The object will automatically redraw itself and the new red star is shown in Figure . FIGURE cShape graphic after assigning an RGB color of 1 0 0 . Drawing a Shape 135 -2-10 1 2 FIGURE cShape graphic scaled using the size mutator. The size can be changed in two ways via the public member variable Size or by multiplying by a scaling constant. Changing the Size with 2 3 results in the plot shown in Figure . The star takes up the same position in the plot however notice that the scales have changed. The figure s size can also be changed by multiplying the shape by a constant. For example the command shape shape results in the plot shown in Figure . Again note the change in the scale. Multiplying is not quite the same as assigning the Size variable because multiplication also sets the private variable mScale. The only real implication of the difference occurs during reset. 1 0 0 FIGURE cShape graphic scaled using the overloaded mtimes. 136 A Guide to MATLAB Object-Oriented Programming FIGURE Graphic for an array of cShape objects. The reset command shape reset shape closes the figure window and resets private member variables back to undrawn values. Arrays of cShape objects can also be drawn. For example the set of commands clear all shape cShape cShape shape 2 .ColorRgb 0 1 0 shape 2

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.