shape

package
v0.0.0-...-2f8f7b3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

圆形

直线

某个坐标点

矩形

扇形

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFarThanDistance

func IsFarThanDistance(a, b Point, distance float64) bool

Types

type Circular

type Circular struct {
	Center Point   // 圆心
	R      float64 // 半径
}

func (Circular) IsInCircular

func (c Circular) IsInCircular(p Point) bool

type Line

type Line struct {
	Start Point
	End   Point
}

func (Line) IsInLine

func (l Line) IsInLine(c Point) bool

判定一个点在一个直线上

type Point

type Point struct {
	X float64
	Y float64
}

func (Point) Cross

func (a Point) Cross(b Point) float64

func (Point) Distance

func (a Point) Distance(b Point) float64

func (Point) Sub

func (a Point) Sub(b Point) Point

func (Point) ToRelative

func (a Point) ToRelative(b Point) Point

type Rectangle

type Rectangle struct {
	AP Point
	BP Point
}

func (Rectangle) IsInRect

func (r Rectangle) IsInRect(p Point) bool

func (Rectangle) MaxXY

func (r Rectangle) MaxXY() (float64, float64)

func (Rectangle) MinXY

func (r Rectangle) MinXY() (float64, float64)

type Sector

type Sector struct {
	Center   Point   // 扇形中心点
	Theta    float64 // 配置的角度
	Distance float64 // 配置的距离
}

func (Sector) IsInSector

func (s Sector) IsInSector(p Point) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL