Exemple #1
0
func (this *NurbsCurve) Transform(mat *mat4.T) *NurbsCurve {
	pts := Dehomogenize1d(this.controlPoints)

	for i := range pts {
		pts[i] = mat.MulVec3(&pts[i])
	}

	return &NurbsCurve{
		this.degree,
		Homogenize1d(pts, Weight1d(this.controlPoints)),
		this.knots,
	}
}
Exemple #2
0
func (this *NurbsSurface) Transform(mat *mat4.T) *NurbsSurface {
	pts := Dehomogenize2d(this.controlPoints)

	for i := range pts {
		for j := range pts[0] {
			pts[i][j] = mat.MulVec3(&pts[i][j])
		}
	}

	return &NurbsSurface{
		this.degreeU,
		this.degreeV,

		Homogenize2d(pts, Weight2d(this.controlPoints)),

		append(KnotVec(nil), this.knotsU...),
		append(KnotVec(nil), this.knotsV...),
	}
}