patterns

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	PatternBase
	// contains filtered or unexported fields
}

Checker Basic checker pattern based on x-axis value

func MakeChecker

func MakeChecker(p1, p2 Pattern) *Checker

MakeChecker Return a basic Checker pattern with two colors

func (Checker) ColorAt

func (c Checker) ColorAt(point primitives.PV) RGB

ColorAt Return color at specific point

type Gradient

type Gradient struct {
	PatternBase
	// contains filtered or unexported fields
}

Gradient Basic gradient pattern based on x-axis value

func MakeGradient

func MakeGradient(p1, p2 Pattern) *Gradient

MakeGradient Return a basic gradient pattern with two colors

func (Gradient) ColorAt

func (g Gradient) ColorAt(point primitives.PV) RGB

ColorAt Return color at specific point

type Material

type Material struct {
	Pat                                                                              Pattern
	Ambient, Diffuse, Specular, Shininess, Reflective, Transparency, RefractiveIndex float64
}

Material Basic Phong material

func MakeDefaultMaterial

func MakeDefaultMaterial() Material

MakeDefaultMaterial Create a basic material

type Pattern

type Pattern interface {
	ColorAt(primitives.PV) RGB
	SetTransform(primitives.Matrix)
}

Pattern Patterns are represented with a GetColorAt function

type PatternBase

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

PatternBase Base class for Pattern objects

func MakePatternBase

func MakePatternBase() PatternBase

MakePatternBase Make an empty PatternBase Object

func (PatternBase) PatternPoint

func (pb PatternBase) PatternPoint(point primitives.PV) primitives.PV

PatternPoint Convert a point to pattern space

func (*PatternBase) SetTransform

func (pb *PatternBase) SetTransform(transform primitives.Matrix)

SetTransform Parent class for pattern interface

type RGB

type RGB struct {
	PatternBase
	// contains filtered or unexported fields
}

RGB represents red, green, and blue values for a color object

func MakeRGB

func MakeRGB(red, green, blue float64) *RGB

MakeRGB Factory method for RGB object

func (RGB) Add

func (r RGB) Add(g RGB) RGB

Add Adds one RGB color to another and returns as a new RGB object

func (RGB) ColorAt

func (r RGB) ColorAt(point primitives.PV) RGB

ColorAt Pattern interface function

func (RGB) Equals

func (r RGB) Equals(g RGB) bool

Equals Compares two RGB color objects with an amount for approximation

func (RGB) Multiply

func (r RGB) Multiply(g RGB) RGB

Multiply Multiples one RGB color to another and returns as a new RGB object

func (RGB) Scale

func (r RGB) Scale(s float64) RGB

Scale Scale an RGB color by a single value and return as a new RGB object

func (RGB) Subtract

func (r RGB) Subtract(g RGB) RGB

Subtract Subtracts one RGB color from another and returns as a new RGB object

func (RGB) ToImageRGBA

func (r RGB) ToImageRGBA() color.RGBA

ToImageRGBA Convert to an RGBA image format

type Stripe

type Stripe struct {
	PatternBase
	// contains filtered or unexported fields
}

Stripe Basic stripe pattern based on x-axis value

func MakeStripe

func MakeStripe(p1, p2 Pattern) *Stripe

MakeStripe Make a stripe pattern from two patterns

func (Stripe) ColorAt

func (s Stripe) ColorAt(point primitives.PV) RGB

ColorAt Calculate which stripe and return the color

type TestPattern

type TestPattern struct {
	PatternBase
}

TestPattern Basic pattern used for testing

func (TestPattern) ColorAt

func (tp TestPattern) ColorAt(point primitives.PV) RGB

ColorAt Return the points as the color

Jump to

Keyboard shortcuts

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