Skip to content
Back to formatted view

Raw Message

Message-ID: <1384787984480-4680695.post@n4.nabble.com>
Date: 2013-11-18T15:19:44Z
From: Carl Witthoft
Subject: Rotation of parallel lines
In-Reply-To: <1384781240.64937.YahooMailNeo@web124501.mail.ne1.yahoo.com>

See my answer at Stack Overflow -- repeated here for anyone else who wants a
trivial function.
# coordinate transform: cartesian plane rotation
xyrot<-function(pairs,ang){
	# pairs must be Nx2 matrix w/ x in first column and y in second
	xrot <- pairs[,1]*cos(ang) - pairs[,2]*sin(ang)
	yrot <- pairs[,1]*sin(ang) + pairs[,2]*cos(ang)
	return(invisible(cbind(xrot,yrot)))
}


tonio wrote
> Dear list, 
> 
> Consider these two parallel segments in a plot.
> 
> plot(c(1, 6), c(2, 2), type="n", xlim=c(0, 7), ylim=c(-2, 6))
> segments(1, 1, 6, 1)
> segments(1, 3, 6, 3)
> 
> 
> 
> How can I rotate the two lines together by a defined angle?
> 
> 
> Thank you all in advance.
> 
> Best,
> Antonio
> 
> 
> ________________________
> Antonio Rivero Ostoic
> Assistant professor, PhD
> 
> AARHUS UNIVERSITY
> School of Business and Social Science
> Quantitative Analytics Group and Cognition and Behaviour Lab
> Bartholins All? 10 
> DK-8000 Aarhus C
> 
> T: +45 871 65421
> M: 

> jari@

> ????????
> 
> ______________________________________________

> R-help@

>  mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.





--
View this message in context: http://r.789695.n4.nabble.com/Rotation-of-parallel-lines-tp4680676p4680695.html
Sent from the R help mailing list archive at Nabble.com.