// SPDX-License-Identifier: MIT
// Derived from Rough.js 4.0.4, Copyright (c) 2019 Preet Shihn.

package rough

import 

func rotatePoints( []Point,  Point,  float64) {
	if len() == 0 {
		return
	}
	,  := [0], [1]
	 := (math.Pi / 180) * 
	,  := math.Cos(), math.Sin()
	for  := range  {
		,  := [][0], [][1]
		// JavaScript rounds each multiplication before the following add or
		// subtract. The jsNumberStep calls prevent Go from fusing these
		// expressions into FMAs, whose one-ULP difference is observable at the
		// renderer's length=200 roughness-gain boundary.
		 := jsNumberStep(( - ) * )
		 := jsNumberStep(( - ) * )
		 := jsNumberStep(( - ) * )
		 := jsNumberStep(( - ) * )
		[][0] =  -  + 
		[][1] =  +  + 
	}
}

func rotateLines( []Line,  Point,  float64) {
	 := make([]Point, 0, len()*2)
	for  := range  {
		 = append(, [][0], [][1])
	}
	rotatePoints(, , )
	for  := range  {
		[][0], [][1] = [*2], [*2+1]
	}
}

func lineLength( Line) float64 {
	return math.Sqrt(
		math.Pow([0][0]-[1][0], 2) +
			math.Pow([0][1]-[1][1], 2),
	)
}