Add outline rendering.

This commit is contained in:
James Grogan 2022-11-18 09:43:22 +00:00
parent f04d86e0ad
commit a20c0183df
20 changed files with 291 additions and 64 deletions

View file

@ -17,7 +17,8 @@ list(APPEND geometry_LIB_INCLUDES
Rectangle.h
Rectangle.cpp
Triangle.h
Triangle.cpp)
Triangle.cpp
Transform.cpp)
# add the library

View file

@ -33,10 +33,18 @@ public:
double getDeltaY(const Point& point) const;
void scale(double x, double y)
void scale(double x, double y, double z = 1.0)
{
mX = x*mX;
mY = y*mY;
mZ = z*mZ;
}
void translate(double x, double y, double z = 0.0)
{
mX += x;
mY += y;
mZ += z;
}
bool operator==(const Point& rhs) const

View file

@ -0,0 +1,10 @@
#include "Transform.h"
Transform::Transform(const Point& location, double scaleX, double scaleY, double scaleZ)
: mLocation(location),
mScaleX(scaleX),
mScaleY(scaleY),
mScaleZ(scaleZ)
{
}

47
src/geometry/Transform.h Normal file
View file

@ -0,0 +1,47 @@
#pragma once
#include "Point.h"
class Transform
{
public:
Transform(const Point& location = {}, double scaleX = 1.0, double scaleY = 1.0, double scaleZ = 1.0);
const Point& getLocation() const
{
return mLocation;
}
double getScaleX() const
{
return mScaleX;
}
double getScaleY() const
{
return mScaleY;
}
double getScaleZ() const
{
return mScaleZ;
}
bool operator==(const Transform& rhs) const
{
return (mLocation == rhs.mLocation)
&& (mScaleX == rhs.mScaleX)
&& (mScaleY == rhs.mScaleY)
&& (mScaleZ == rhs.mScaleZ);
}
bool operator!=(const Transform& rhs) const
{
return !operator==(rhs);
}
private:
Point mLocation;
double mScaleX{1};
double mScaleY{1};
double mScaleZ{1};
};