R/Class-SimilarityTransformation.R

### SimilarityTransformation class ###
## Similarity transformations can be written as:
##      x' = ax + by + c
##      y' = ay - bx + d
setClass("SimilarityTransformation",
	representation(),
	contains = "Cartesian2DCoordinateTransformation",
	validity = function(object) {
		if (length(object@parameters) == 0){
			if (nrow(object@controlPoints) < 2)
				stop("At least 2 control points (rows in the data.frame 'controlPoints') are required for the similarity transformation")
		}
		else if (length(object@parameters) != 4){ 
			stop("Similarity transformations require 4 parameters!")
		}
		return(TRUE)
	}
)

Try the vec2dtransf package in your browser

Any scripts or data that you put into this service are public.

vec2dtransf documentation built on Aug. 23, 2023, 5:07 p.m.