<commit_before>// ###new NurbsSurface( degreeU, knotsU, degreeV, knotsV, controlPoints, weights )
//
// Constructor for a NurbsSurface
//
// **params**
// + *Number*, The degree of the surface in the u direction
// + *Array*, Array of numbers representing the knot positions in the u direction
// + *Number*, The degree of the surface in the v direction
// + *Array*, Array of numbers representing the knot positions in the v direction
// + *Array*, 3d array representing the unweighted control points
// + *Array*, 2d array representing the surface weight structure
//

verb.geom.NurbsSurface = function( degreeU, knotsU, degreeV, knotsV, controlPoints, weights ) {

	verb.geom.NurbsGeometry.call(this);

	this.setAll({
		"controlPoints": controlPoints,
		"weights": weights,
		"knotsU": knotsU ? knotsU.slice(0) : [],
		"knotsV": knotsV ? knotsV.slice(0) : [],
		"degreeU": degreeU,
		"degreeV": degreeV
	});

}.inherits( verb.geom.NurbsGeometry );

//
// ####point( u, v [, callback] )
//
// Sample a point at the given u, v parameter 
//
// **params**
// + *Number*, The u parameter at which to sample
// + *Number*, The v parameter at which to sample
// + *Function*, Optional callback to do it async
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.point = function( u, v, callback ) {

	return this.nurbsEngine.eval( 'rational_surface_point', 
							[ 	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), u, v ], callback );

};

//
// ####derivatives( u, v, num_derivs [, callback] )
//
// Get derivatives at a given u, v parameter
//
// **params**
// + *Number*, The u parameter to sample the curve
// + *Number*, The v parameter to sample the curve
// + *Number*, The number of derivatives to obtain
// + *Number*, The callback, if you want this async
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.derivatives = function( u, v, num_derivs, callback ) {

	return this.nurbsEngine.eval( 'rational_surface_derivs', 
			[	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), num_derivs, u, v ], callback ); 

};

//
// ####tesselate(options [, callback] )
//
// Tesselate the surface
//
// **params**
// + *Object*, Tesselate the surface, given an options object includings a vdivs and udivs property
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.tesselate = function(options, callback){

	var minDivsV = 20
		, minDivsU = 20;

	if (options){
		minDivsV = options.minDivsV || minDivsV;
		minDivsU = options.minDivsU || minDivsU;
	}

	// naive surface tesselation, for now
	return this.nurbsEngine.eval( 'tesselate_rational_surface_naive', 
			[	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), 
			minDivsU, minDivsV ], callback ); 

};

//
// ####transform( mat )
//
// Transform a curve with the given matrix.
//
// **params**
// + *Array*, 4d array representing the transform<commit_msg>NurbsSurface.domain<commit_after>// ###new NurbsSurface( degreeU, knotsU, degreeV, knotsV, controlPoints, weights )
//
// Constructor for a NurbsSurface
//
// **params**
// + *Number*, The degree of the surface in the u direction
// + *Array*, Array of numbers representing the knot positions in the u direction
// + *Number*, The degree of the surface in the v direction
// + *Array*, Array of numbers representing the knot positions in the v direction
// + *Array*, 3d array representing the unweighted control points
// + *Array*, 2d array representing the surface weight structure
//

verb.geom.NurbsSurface = function( degreeU, knotsU, degreeV, knotsV, controlPoints, weights ) {

	verb.geom.NurbsGeometry.call(this);

	this.setAll({
		"controlPoints": controlPoints,
		"weights": weights,
		"knotsU": knotsU ? knotsU.slice(0) : [],
		"knotsV": knotsV ? knotsV.slice(0) : [],
		"degreeU": degreeU,
		"degreeV": degreeV
	});

}.inherits( verb.geom.NurbsGeometry );

//
// ####point( u, v [, callback] )
//
// Sample a point at the given u, v parameter 
//
// **params**
// + *Number*, The u parameter at which to sample
// + *Number*, The v parameter at which to sample
// + *Function*, Optional callback to do it async
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.point = function( u, v, callback ) {

	return this.nurbsEngine.eval( 'rational_surface_point', 
							[ 	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), u, v ], callback );

};

//
// ####derivatives( u, v, num_derivs [, callback] )
//
// Get derivatives at a given u, v parameter
//
// **params**
// + *Number*, The u parameter to sample the curve
// + *Number*, The v parameter to sample the curve
// + *Number*, The number of derivatives to obtain
// + *Number*, The callback, if you want this async
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.derivatives = function( u, v, num_derivs, callback ) {

	return this.nurbsEngine.eval( 'rational_surface_derivs', 
			[	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), num_derivs, u, v ], callback ); 

};

//
// ####tesselate(options [, callback] )
//
// Tesselate the surface
//
// **params**
// + *Object*, Tesselate the surface, given an options object includings a vdivs and udivs property
//
// **returns**
// + *Array*, An array if called synchronously, otherwise nothing

verb.geom.NurbsSurface.prototype.tesselate = function(options, callback){

	var minDivsV = 20
		, minDivsU = 20;

	if (options){
		minDivsV = options.minDivsV || minDivsV;
		minDivsU = options.minDivsU || minDivsU;
	}

	// naive surface tesselation, for now
	return this.nurbsEngine.eval( 'tesselate_rational_surface_naive', 
			[	this.get('degreeU'), this.get('knotsU'), this.get('degreeV'), this.get('knotsV'), this.homogenize(), 
			minDivsU, minDivsV ], callback ); 

};

//
// ####domain()
//
// Determine the valid domain of the surface
//
//
// **returns**
// + *Array*, An 2d array e.g. [[lowU, highU], [lowV, highV]]

verb.geom.NurbsSurface.prototype.domain = function() {

	var knotsU = this.get('knotsU');
	var knotsV = this.get('knotsV');
	return [ [ knotsU[0], knotsU[knotsU.length-1] ], [ knotsV[0], knotsV[knotsV.length-1] ] ];

}

//
// ####transform( mat )
//
// Transform a curve with the given matrix.
//
// **params**
// + *Array*, 4d array representing the transform
{'fraction_non_alphanumeric': 0.16654219566840925, 'fraction_numerical': 0.0034353995519044063, 'mean_word_length': 3.782857142857143, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4096504', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2185, 'n_words': 652}