FCT
载入中...
搜索中...
未找到
FractionScale2D.h
浏览该文件的文档.
1//
2// Created by Administrator on 2025/8/11.
3//
4
5#ifndef FRACTIONSCALE2D_H
6#define FRACTIONSCALE2D_H
7#include "./Fraction.h"
8namespace FCT
9{
13
14 FractionScale2D() noexcept : width(1), height(1) {}
15 FractionScale2D(const Fraction& w, const Fraction& h) noexcept : width(w), height(h) {}
16 FractionScale2D(const Fraction& uniform) noexcept : width(uniform), height(uniform) {}
17
18 FractionScale2D operator*(const FractionScale2D& other) const noexcept {
19 return FractionScale2D(width * other.width, height * other.height);
20 }
21
22 FractionScale2D operator/(const FractionScale2D& other) const noexcept {
23 return FractionScale2D(width / other.width, height / other.height);
24 }
25
26 bool operator==(const FractionScale2D& other) const noexcept {
27 return width == other.width && height == other.height;
28 }
29
30 bool operator!=(const FractionScale2D& other) const noexcept {
31 return !(*this == other);
32 }
33
34 bool isUnit() const noexcept {
35 return width.isUnit() && height.isUnit();
36 }
37 };
38}
39#endif //FRACTIONSCALE2D_H
FractionScale2D(const Fraction &uniform) noexcept
bool operator==(const FractionScale2D &other) const noexcept
bool operator!=(const FractionScale2D &other) const noexcept
FractionScale2D operator*(const FractionScale2D &other) const noexcept
bool isUnit() const noexcept
FractionScale2D(const Fraction &w, const Fraction &h) noexcept
FractionScale2D operator/(const FractionScale2D &other) const noexcept