11/8/2018 COMP 475: Fall 2018
c++代写 | 代写算法 | 代写assignment | 数据结构代写 | c语言代写 – 本题是一个利用c++进行练习的代做, 对图算法的流程进行训练解析, 是比较有代表性的c++ | 算法 等代写方向, 该题目是值得借鉴的assignment代写的题目
COMP 475: Fall 2018
Programming assignment 5
Curves and tiling
class GPath {
public:
enum Verb {
...
kQuad , // returns pts[0]..pts[2] from Iter and Edger
kCubic , // returns pts[0]..pts[3] from Iter and Edger
...
};
...
/**
* Append a new contour respecting the Direction. The contour should be an approximate
* circle (8 quadratic curves will suffice) with the specified center and radius.
*/
GPath& addCircle(GPoint center, float radius, Direction = kCW_Direction) ;
...
static void ChopQuadAt(const GPoint src[3], GPoint dst[5], float t);
static void ChopCubicAt(const GPoint src[4], GPoint dst[7], float t);
};
class GCanvas {
public:
...
// Handle quadratic and cubic curves in the path when drawing.
// Draw curves with a tolerance of 1/4 pixel
virtual void drawPath(const GPath& path, const GPaint&) = 0;
};
class GShader {
enum TileMode {
kClamp,
kRepeat,
kMirror,
};
...
};
std::unique_ptr<GShader> GCreateBitmapShader(..., TileMode );
std::unique_ptr<GShader> GCreateLinearGradient(..., TileMode );
Your task is to support curves (quadratic and cubic) in GPath and drawing to GCanvas, and implement tiling modes in
your shaders (bitmap and gradient).
Implement curves in GPath
addCircle()
ChopQuadAt()
ChopCubicAt()
Draw curves in GCanvas::drawPath()
Handle kQuad and kCubic in GPath::Edger
Compute segment count for eaching using flatten test
Generate line segments and app to edge list
Support TileMode parameter in Bitmap and Gradient Shaders
We are adding curves to GPath. Your job is to extend you scan converter to recognize the kQuad and kCubic verbs and
draw the curves (using 0.25 for the tolerance).
GPath has a new method, addCircle(), that you’ll need to implement. 8 quadratics is a sufficient approximation.
GPath also has 2 utility methods for chopping curves. Implement these.
Finally you’re adding tiling modes to your bitmap and gradient shaders. In PA4 they implicitly use clamp to handle
out-of-domain samples. Now they should respect whatever TileMode is passed to their factory.
Your directory should like something like this:
apps contains the code for testing your code.
expected contains sample output from the image tool to compare with your output.
include contains class headers that your code can use.
src contains common implementations needed for the tools.
DO NOT EDIT/ADD/REMOVE anything in these sub-directories. You should only add files to the root of the
directory.
your_files any .cpp or .h files you need for your implementation. All of your work must be here.
To test your code…
> make
> ./image -e expected
> ./tests
> ./bench