lab002

package
v0.0.0-...-f10d331 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 0 Imported by: 0

README

计算一个点是否在线上,不在线上的话,判断点在斜线的下方还是上方

计算一个点在斜线的上方还是下方,还是在线上。

Documentation

Index

Constants

View Source
const (
	POINT_ABOVE = 1  //在上方
	POINT_ON    = 0  //在线上
	POINT_UNDER = -1 //在下方
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	P1, P2 *Point
	K, B   float64
}

func NewLine

func NewLine(p1, p2 *Point) *Line

func (*Line) CalB

func (line *Line) CalB()

计算b

func (*Line) CalK

func (line *Line) CalK()

计算k

func (*Line) CalKB

func (line *Line) CalKB()

计算斜线的k和b

func (*Line) CalPointPos

func (line *Line) CalPointPos(p *Point) int

判断点的位置,在斜线上方,下方和在线上

func (*Line) CalY

func (line *Line) CalY(x float64) float64

通过x计算y

type Point

type Point struct {
	X, Y float64
}

Jump to

Keyboard shortcuts

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