Documentation ¶
Index ¶
- Variables
- func DegreeToRadian[T geometryNumber](angle T) T
- func RadianToDegree[T geometryNumber](angle T) T
- type Angle
- type AngleDirection
- func (t AngleDirection) MarshalJSON() ([]byte, error)
- func (t AngleDirection) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (t AngleDirection) MarshalYAML() (interface{}, error)
- func (t *AngleDirection) Scan(value interface{}) error
- func (t AngleDirection) String() string
- func (t *AngleDirection) UnmarshalJSON(data []byte) error
- func (t *AngleDirection) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (t *AngleDirection) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (t AngleDirection) Value() (driver.Value, error)
- type AngleType
- func (t AngleType) MarshalJSON() ([]byte, error)
- func (t AngleType) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (t AngleType) MarshalYAML() (interface{}, error)
- func (t *AngleType) Scan(value interface{}) error
- func (t AngleType) String() string
- func (t *AngleType) UnmarshalJSON(data []byte) error
- func (t *AngleType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (t *AngleType) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (t AngleType) Value() (driver.Value, error)
- type CartesianCoordinate
- type Circle
- type Dimension2d
- type LineSegment
- func (t LineSegment[T]) IntersectAt(segment LineSegment[T]) CartesianCoordinate[T]
- func (t LineSegment[T]) Length() T
- func (t LineSegment[T]) Midpoint() CartesianCoordinate[T]
- func (t LineSegment[T]) PointAtPercent(percentage T) CartesianCoordinate[T]
- func (t LineSegment[T]) Slope() T
- func (t LineSegment[T]) SlopeIntercept() SlopeInterceptLine[T]
- func (t LineSegment[T]) Standard() StandardLine[T]
- type PolarCoordinate
- type Rectangle
- func (t Rectangle[T]) Area() T
- func (t Rectangle[T]) BottomLeft() CartesianCoordinate[T]
- func (t Rectangle[T]) BottomMidpoint() CartesianCoordinate[T]
- func (t Rectangle[T]) BottomRight() CartesianCoordinate[T]
- func (t Rectangle[T]) Center() CartesianCoordinate[T]
- func (t Rectangle[T]) LeftMidpoint() CartesianCoordinate[T]
- func (t Rectangle[T]) Perimeter() T
- func (t Rectangle[T]) PointOnPeremiter(angle Angle[T]) CartesianCoordinate[T]
- func (t Rectangle[T]) RightMidpoint() CartesianCoordinate[T]
- func (t Rectangle[T]) TopMidpoint() CartesianCoordinate[T]
- func (t Rectangle[T]) TopRight() CartesianCoordinate[T]
- type SlopeInterceptLine
- type StandardLine
Constants ¶
This section is empty.
Variables ¶
View Source
var AngleDirections = angleDirections{ Err: fmt.Errorf("invalid AngleDirection"), Invalid: AngleDirection("invalid"), Clockwise: AngleDirection("clockwise"), CounterClockwise: AngleDirection("counter-clockwise"), }
Functions ¶
func DegreeToRadian ¶
func DegreeToRadian[T geometryNumber](angle T) T
func RadianToDegree ¶
func RadianToDegree[T geometryNumber](angle T) T
Types ¶
type Angle ¶
type Angle[T geometryNumber] struct { Magnitude T Type AngleType Direction AngleDirection }
type AngleDirection ¶
type AngleDirection string
func (AngleDirection) MarshalJSON ¶
func (t AngleDirection) MarshalJSON() ([]byte, error)
func (AngleDirection) MarshalXML ¶ added in v1.0.31
func (t AngleDirection) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (AngleDirection) MarshalYAML ¶
func (t AngleDirection) MarshalYAML() (interface{}, error)
func (*AngleDirection) Scan ¶
func (t *AngleDirection) Scan(value interface{}) error
func (AngleDirection) String ¶
func (t AngleDirection) String() string
func (*AngleDirection) UnmarshalJSON ¶
func (t *AngleDirection) UnmarshalJSON(data []byte) error
func (*AngleDirection) UnmarshalXML ¶ added in v1.0.31
func (t *AngleDirection) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
func (*AngleDirection) UnmarshalYAML ¶
func (t *AngleDirection) UnmarshalYAML(unmarshal func(interface{}) error) error
type AngleType ¶
type AngleType string
func (AngleType) MarshalJSON ¶
func (AngleType) MarshalXML ¶ added in v1.0.31
func (AngleType) MarshalYAML ¶
func (*AngleType) UnmarshalJSON ¶
func (*AngleType) UnmarshalXML ¶ added in v1.0.31
func (*AngleType) UnmarshalYAML ¶
type CartesianCoordinate ¶
type CartesianCoordinate[T geometryNumber] struct { X T Y T }
func PolarToCartesian ¶
func PolarToCartesian[T geometryNumber](coordinate PolarCoordinate[T]) CartesianCoordinate[T]
type Circle ¶
type Circle[T geometryNumber] struct { Center CartesianCoordinate[T] Radius T }
func NewCircle ¶
func NewCircle[T geometryNumber](center CartesianCoordinate[T], radius T) Circle[T]
func NewCircleXY ¶
func NewCircleXY[T geometryNumber](x, y, radius T) Circle[T]
func (Circle[T]) PointOnCircumference ¶
func (t Circle[T]) PointOnCircumference(angle Angle[T]) CartesianCoordinate[T]
func (Circle[T]) PointOnDiameter ¶
func (t Circle[T]) PointOnDiameter(percent T) CartesianCoordinate[T]
func (Circle[T]) XCoordinate ¶
func (t Circle[T]) XCoordinate(y T) CartesianCoordinate[T]
(x – h)^2 + (y – k)^2 = r^2
(x – h)^2 = r^2 - (y – k)^2 x - h = √(r^2 - (y – k)^2) x = h + √(r^2 - (y – k)^2)
func (Circle[T]) YCoordinate ¶
func (t Circle[T]) YCoordinate(x T) CartesianCoordinate[T]
(x – h)^2 + (y – k)^2 = r^2
(y – k)^2 = r^2 - (x – h)^2 y – k = √(r^2 - (x – h)^2) y = k + √(r^2 - (x – h)^2)
type Dimension2d ¶
func NewDimension2d ¶
func NewDimension2d[T types.Numbers](height, width T) Dimension2d[T]
type LineSegment ¶
type LineSegment[T geometryNumber] struct { Start CartesianCoordinate[T] End CartesianCoordinate[T] }
func NewLineSegmentCoords ¶
func NewLineSegmentCoords[T geometryNumber](start, end CartesianCoordinate[T]) LineSegment[T]
func NewLineSegmentXY ¶
func NewLineSegmentXY[T geometryNumber](x1, y1, x2, y2 T) LineSegment[T]
func (LineSegment[T]) IntersectAt ¶
func (t LineSegment[T]) IntersectAt(segment LineSegment[T]) CartesianCoordinate[T]
https://www.cuemath.com/geometry/intersection-of-two-lines/ https://www.cuemath.com/algebra/cross-multiplication-method/
func (LineSegment[T]) Length ¶
func (t LineSegment[T]) Length() T
func (LineSegment[T]) Midpoint ¶
func (t LineSegment[T]) Midpoint() CartesianCoordinate[T]
func (LineSegment[T]) PointAtPercent ¶
func (t LineSegment[T]) PointAtPercent(percentage T) CartesianCoordinate[T]
func (LineSegment[T]) Slope ¶
func (t LineSegment[T]) Slope() T
func (LineSegment[T]) SlopeIntercept ¶
func (t LineSegment[T]) SlopeIntercept() SlopeInterceptLine[T]
func (LineSegment[T]) Standard ¶
func (t LineSegment[T]) Standard() StandardLine[T]
type PolarCoordinate ¶
type PolarCoordinate[T geometryNumber] struct { Radius T Angle Angle[T] }
func CartesianToPolar ¶
func CartesianToPolar[T geometryNumber](coordinate CartesianCoordinate[T]) PolarCoordinate[T]
type Rectangle ¶
type Rectangle[T geometryNumber] struct { TopLeft CartesianCoordinate[T] Dimensions Dimension2d[T] }
func NewRectangle ¶
func NewRectangle[T geometryNumber](topLeft CartesianCoordinate[T], dimensions Dimension2d[T]) Rectangle[T]
func NewRectangleXYHW ¶
func NewRectangleXYHW[T geometryNumber](x, y, height, width T) Rectangle[T]
func (Rectangle[T]) BottomLeft ¶
func (t Rectangle[T]) BottomLeft() CartesianCoordinate[T]
func (Rectangle[T]) BottomMidpoint ¶
func (t Rectangle[T]) BottomMidpoint() CartesianCoordinate[T]
func (Rectangle[T]) BottomRight ¶
func (t Rectangle[T]) BottomRight() CartesianCoordinate[T]
func (Rectangle[T]) Center ¶
func (t Rectangle[T]) Center() CartesianCoordinate[T]
func (Rectangle[T]) LeftMidpoint ¶
func (t Rectangle[T]) LeftMidpoint() CartesianCoordinate[T]
func (Rectangle[T]) PointOnPeremiter ¶
func (t Rectangle[T]) PointOnPeremiter(angle Angle[T]) CartesianCoordinate[T]
func (Rectangle[T]) RightMidpoint ¶
func (t Rectangle[T]) RightMidpoint() CartesianCoordinate[T]
func (Rectangle[T]) TopMidpoint ¶
func (t Rectangle[T]) TopMidpoint() CartesianCoordinate[T]
func (Rectangle[T]) TopRight ¶
func (t Rectangle[T]) TopRight() CartesianCoordinate[T]
type SlopeInterceptLine ¶
type SlopeInterceptLine[T geometryNumber] struct { M T B T }
func (SlopeInterceptLine[T]) Segment ¶
func (t SlopeInterceptLine[T]) Segment(x1, x2 T) LineSegment[T]
func (SlopeInterceptLine[T]) Y ¶
func (t SlopeInterceptLine[T]) Y(x T) T
type StandardLine ¶
type StandardLine[T geometryNumber] struct { A T B T C T }
Click to show internal directories.
Click to hide internal directories.