sphere

package
Version: v0.0.0-...-1b60a0e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sphere represents a sphere object with an origin and radius.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalAt

func NormalAt(s *Sphere, worldSpacePoint *point.Point) (*vector.Vector, error)

NormalAt returns the normal vector on the passed Sphere, at the passed Point. The function assumes that the passed Point will always be on the surface of the sphere.

Types

type Sphere

type Sphere struct {
	Id        string
	Origin    *point.Point
	Radius    float64
	Transform *matrix.Matrix
	Material  *material.Material
}

Sphere is a sphere object with an origin and radius.

func NewSphere

func NewSphere(id string, origin point.Point, radius float64) *Sphere

NewSphere returns a new Sphere with the passed id, origin, and radius.

func NewUnitSphere

func NewUnitSphere(id string) *Sphere

NewUnitSphere returns a new Sphere with id, origin (0,0,0), and a radius of 1.

func (*Sphere) SetTransform

func (s *Sphere) SetTransform(m *matrix.Matrix)

SetTransform sets the transform of this Sphere.

Source Files

Jump to

Keyboard shortcuts

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