zawatins-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub zawa-tin/zawatins-library

:heavy_check_mark: base (ベース)
(src/geometryR2/base.hpp)

概要

geometryR2に属するのほぼ全ての関数、classで利用されるであろうエイリアスや関数をまとめたファイル

機能

namespace geo2d内で定義される。実際にコンテストで利用する時はusing namespace geo2dすることをおすすめする

エイリアス

using real = long double

値の型


定数

const realType PI = acosl(-1);

円周率


関数

eps

inline real &eps()

現在のEPSを返します。初期状態では $10^{-14}$ に設定されています。


setEps

inline void &setEps(real value = 1e-14)

EPSをvalueの値に変更します


sgn

inline int sgn(real value)

valueが負なら-1を正なら1を零なら0を返す


equals

inline bool equals(const real& a, const real& b)

引数に与えた実数a, bが等しいか判定する


toRadian

real toRadian(const real& value)

引数valueを弧度法にしたものを返す。


ユーザー定義リテラル

namespace literal上で定義されている。include時点でusing namespace literalが適用される

_rad

geoR2::real operator"" _rad(unsigned long long value)

valueを弧度法にしたものを返す。

Required by

Verified with

Code

#pragma once

#include <cmath>

namespace geoR2 {

using real = long double;

const real PI = acosl(-1);

inline real &eps() {
	static real EPS = 1e-14;
	return EPS;
}

inline void setEps(const real& EPS = 1e-14) {
	eps() = EPS;
}

inline int sgn(const real& value) {
	return (value < -eps() ? -1 : (value > +eps() ? 1 : 0));
}

inline bool equals(const real& a, const real& b) {
	return sgn(a - b) == 0;
}

inline real toRadian(const real& value) {
	return (value * PI) / 180;
}

} // namespace geoR2

namespace literals {

geoR2::real operator"" _rad(unsigned long long value) {
	return (static_cast<geoR2::real>(value) * geoR2::PI) / static_cast<geoR2::real>(180);
}

} // namespace literals

using namespace literals;
#line 2 "src/geometryR2/base.hpp"

#include <cmath>

namespace geoR2 {

using real = long double;

const real PI = acosl(-1);

inline real &eps() {
	static real EPS = 1e-14;
	return EPS;
}

inline void setEps(const real& EPS = 1e-14) {
	eps() = EPS;
}

inline int sgn(const real& value) {
	return (value < -eps() ? -1 : (value > +eps() ? 1 : 0));
}

inline bool equals(const real& a, const real& b) {
	return sgn(a - b) == 0;
}

inline real toRadian(const real& value) {
	return (value * PI) / 180;
}

} // namespace geoR2

namespace literals {

geoR2::real operator"" _rad(unsigned long long value) {
	return (static_cast<geoR2::real>(value) * geoR2::PI) / static_cast<geoR2::real>(180);
}

} // namespace literals

using namespace literals;
Back to top page