Render Part B Assignment

From CSE425S Wiki
Jump to navigation Jump to search

In this studio we will evolve our code from Render_Part_A_Assignment to leverage class hierarchies.

File:Part b class hierarchy.png

Continue editing files in the render/assignment directory.

In this studio, we will have parameters for which explicitly passed arguments are not required (for convenience and backwards compatibility). We will prefer keyword arguments over optional arguments.

Code to Implement

Transform

superclass: Object

Transform's constructor should take x and y parameters and store them in instance variables.

It should define a render method which preserves the current model view transformation, translates in the z==0 plane, passes the render_transformed message to itself, and restores the model view transformation.

All subclasses must implement a private render_transformed method.

Image

from Part A

superclass: Transform

ColorTransform

superclass: Transform

Text

from Part A

superclass: ColorTransform

Ellipse

from Part A

superclass: ColorTransform

EquilateralTriangle

from Part A

superclass: ColorTransform

BezierCurve

from Part A

superclass: ColorTransform

Chord

from Part A

superclass: ColorTransform

Rectangle

from Part A

superclass: ColorTransform

CompositeTransform

superclass: Transform

class Scene

superclass: Object

Testing Your Solution

Unit Testing

ruby/render/part_b_test/part_b_unit_test.rb

Visual Comparison

ruby/render/part_b_test/part_b_test_snapshots_web_page_generator.rb