Processing math: 100%

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: segment (線分)
(src/geometryR2/segment.hpp)

概要

線分を管理する構造体

機能

namespace geoR2上で定義される

メンバ変数

e1

point e1

端点


e2

point e2

端点


コンストラクタ

(1) segment()
(2) segment(const point& _e1, const point& _e2)

(1)

端点を両方とも原点で初期化する。これは線分として有効では無いので利用する際は値の再代入が必要です


(2)

端点を e1,e2 で初期化する。e1 = e2 である時は線分として有効で無いため色んな関数でassertに引っかかりまくります。かわいそう


メンバ関数

isValid

bool isValid() const

線分が有効かを判定する。

e1e2 ならtrueを返す。

Depends on

Required by

Verified with

Code

#pragma once

#include "./ccw.hpp"
#include "./point.hpp"

namespace geoR2 {

struct segment {

	point e1, e2;

	segment() : e1(), e2() {}
	segment(const point& _e1, const point& _e2) : e1(_e1), e2(_e2) {}

	bool isValid() const {
		return !equals(e1, e2);
	}
};

} // namespace R2
Back to top page