/
ArtemNech
/
simpleOpenGL
Обзор
Документация
Войти
/
ArtemNech
/
simpleOpenGL
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
devOpt
backend/graphics-units/NSize.cpp
109 строк
2 KB
Artem Nechitaylenko
initial
16 май 2026, 12:48
16 май 2026, 12:48
0d3ac6c
Код
Авторство
О чём код?
// // Created by artem on 20.10.25. // #include "NSize.h" #include <cmath> namespace ngraph { NSize::NSize() = default; NSize::NSize(int width, int height) : m_width(width) , m_height(height) {} int NSize::width() const { return m_width; } int NSize::height() const { return m_height; } void NSize::setWidth(int width) { m_width = std::abs(width); } void NSize::setHeight(int height) { m_height = std::abs(height); } bool NSize::isEmpty() const { return m_height == 0 || m_width == 0; } bool NSize::isValid() const { return m_width > 0 && m_height > 0; } bool NSize::operator==(const NSize &other) const { return m_width == other.m_width && m_height == other.m_height; } bool NSize::operator!=(const NSize &other) const { return !(*this == other); } // ================================================================================================================ // ================================================================================================================ // ================================================================================================================ NSizeF::NSizeF() = default; NSizeF::NSizeF(double width, double height) : m_width(width) , m_height(height){} double NSizeF::width() const { return m_width; } double NSizeF::height() const { return m_height; } void NSizeF::setWidth(double width) { m_width = std::fabs(width); } void NSizeF::setHeight(double height) { m_height = std::fabs(height); } bool NSizeF::isEmpty() const { return floats::is_floats_equal(m_width, 0) && floats::is_floats_equal(m_height, 0); } bool NSizeF::isValid() const { return !floats::is_floats_equal(m_width, 0) && !floats::is_floats_equal(m_height, 0); } bool NSizeF::operator==(const NSize &other) const { return floats::is_floats_equal(this->width(), other.width()) && floats::is_floats_equal(this->height(), other.height()); } bool NSizeF::operator!=(const NSize &other) const { return !(*this==other); } }