body

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: GPL-3.0, GPL-3.0-or-later Imports: 3 Imported by: 0

Documentation

Overview

Package body implement Body model, which store basic Geometry description.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	ID       ID       `json:"id"`
	Name     string   `json:"name,omitempty"`
	Geometry Geometry `json:"geometry"`
}

Body store Geometry interface described by ID and Name.

func (*Body) UnmarshalJSON

func (body *Body) UnmarshalJSON(b []byte) error

UnmarshalJSON custom Unmarshal function. GeometryType is recognized by geometry/type in json.

type Cuboid

type Cuboid struct {
	Center common.Point `json:"center"`
	Size   common.Vec3D `json:"size"`
}

Cuboid represent cuboid of given sizes in a space.

func (Cuboid) MarshalJSON

func (c Cuboid) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementaion.

type Cylinder

type Cylinder struct {
	Center common.Point `json:"baseCenter"`
	Height float64      `json:"height"`
	Radius float64      `json:"radius"`
}

Cylinder represent cylinder of given sizes in a space.

func (Cylinder) MarshalJSON

func (c Cylinder) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementaion.

type Geometry

type Geometry interface {
	json.Marshaler
}

Geometry is a variant type, which represent different geometries used in simulations. It must implement json.Marshaler to marshal geometry type dependant on Geometry implementation type.

type ID

type ID int64

ID is key type in Body map.

type Sphere

type Sphere struct {
	Center common.Point `json:"center"`
	Radius float64      `json:"radius"`
}

Sphere represent sphere with given radius in space.

func (Sphere) MarshalJSON

func (s Sphere) MarshalJSON() ([]byte, error)

MarshalJSON json.Marshaller implementaion.

Jump to

Keyboard shortcuts

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