camera

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Unlicense Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera struct {
	//where the camera is positioned
	Eye vec3.T

	//the sight-direction will be calculated starting from the eye - just any point on sight
	LooksThrough vec3.T

	//rotation around the sight-axis (lt - eye)
	Rotation float64

	//a sensor size can be set here, changes will result in zoom effect, default should be 36mm for 'vollformat'
	SensorWidth float64

	//the zoom-length of the camera, will move the projection-layer from the camera back and forwards
	//with sensor-width 36mm should be at least 30mm (extremely-wide) to max 200mm (extreme-zoom)
	FocalLength float64

	//see https://www.fotomagazin.de/technik/der-bildwinkel
	ViewingAngleWidth float64

	LToProjectionArea float64

	//the projection-width is the width of the projection-area where the image in px will be projected on
	//this should be in normal cases 100mm
	//with a fixed projection-width, every width/height px produces the same image, just less sharp (or more)
	ProjectionWidth float64

	//will be calculated from width and the image dimensions
	ProjectionHeight float64

	ProjectionScale    float64
	ProjectionScaleInv float64

	//lenscorrection warps the image before/after the necessary transformations are finished, so its on top of everything else
	//can be nil -> no lenscorrection will be applied
	LensCorrection *float64

	//can be nil when lenscorrection is set -> will then be width/2 and height/2
	LensCorrectionCenter *vec2.T

	Width  float64
	Height float64
	// contains filtered or unexported fields
}

func FromDto

func FromDto(dto *CameraDto) *Camera

func (*Camera) ConvertImagePointToPlanePoint

func (c *Camera) ConvertImagePointToPlanePoint(raw *vec2.T) vec3.T

func (*Camera) ConvertPlanePointToImagePoint

func (c *Camera) ConvertPlanePointToImagePoint(pt *vec3.T) vec2.T

WATCH OUT; POINT MUST ALREADY BE IN PLANE, USE ProjectPointIntoImage instead

func (*Camera) ProjectPointIntoImage

func (c *Camera) ProjectPointIntoImage(pt *vec3.T) vec2.T

func (*Camera) ProjectPointIntoPlane

func (c *Camera) ProjectPointIntoPlane(pt *vec3.T) vec3.T

type CameraDto

type CameraDto struct {
	//where the camera is positioned
	Eye dto.JsonVector3 `json:"CameraEye" validate:"required"`

	//the sight-direction will be calculated starting from the eye
	LooksThrough dto.JsonVector3 `json:"LooksThrough" validate:"required"`

	//rotation around the sight-axis (lt - eye)
	Rotation float64 `json:"Rotation" validate:"required"`

	//a sensor size can be set here, changes will result in zoom effect, default should be 36mm for 'vollformat'
	SensorWidth float64 `json:"SensorWidth" validate:"required"`

	//the zoom-length of the camera, will move the projection-layer from the camera back and forwards
	//with sensor-width 36mm should be at least 30mm (extremely-wide) to max 200mm (extreme-zoom)
	FocalLength float64 `json:"FocalLength" validate:"required"`

	//the projection-width is the width of the projection-area where the image in px will be projected on
	//this should be in normal cases 100mm
	//with a fixed projection-width, every width/height px produces the same image, just less sharp (or more)
	ProjectionWidth float64 `json:"ProjectionWidth" validate:"required"`

	//lenscorrection warps the image before/after the necessary transformations are finished, so its on top of everything else
	//can be nil -> no lenscorrection will be applied
	//plausible from -1 to 1
	LensCorrection *float64 `json:"LensCorrection"`

	//can be nil when lenscorrection is set -> will then be width/2 and height/2
	LensCorrectionCenter *dto.JsonVector2 `json:"LensCorrectionCenter"`

	//the rendered image sizes
	Width int32 `json:"Width" validate:"required"`

	//the rendered image sizes
	Height int32 `json:"Height" validate:"required"`
}

func LoadFromJson

func LoadFromJson(jsonData string) (*CameraDto, error)

func LoadFromJsonPath

func LoadFromJsonPath(path string) (*CameraDto, error)

Jump to

Keyboard shortcuts

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