simpleshape

package
Version: v0.0.0-...-d41341d Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2018 License: BSD-3-Clause Imports: 0 Imported by: 6

Documentation

Overview

Package simpleshape is a simple interface for representing geometric shapes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShapeArea

func ShapeArea(s Shape) float64

Calculates the area of a shape. The area calculation is based on the type of shape s.

Types

type Rectangle

type Rectangle struct {
	// contains filtered or unexported fields
}

func NewRectangle

func NewRectangle(w float64, h float64) *Rectangle

func (*Rectangle) Area

func (r *Rectangle) Area() float64

type Shape

type Shape interface {
	Area() float64
}

The Shape type represents a geometric shape.

type Triangle

type Triangle struct {
	// contains filtered or unexported fields
}

func NewTriangle

func NewTriangle(b float64, h float64) *Triangle

func (*Triangle) Area

func (t *Triangle) Area() float64

Jump to

Keyboard shortcuts

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