package org.papervision3d.core.math { /** * The student_ar_org_papervision3d_core_math_NumberUV class represents a value in a texture UV coordinate system. * * Properties u and v represent the horizontal and vertical texture axes respectively. * */ public class student_ar_org_papervision3d_core_math_NumberUV { /** * The horizontal coordinate value. */ public var u: Number; /** * The vertical coordinate value. */ public var v: Number; /** * Creates a new student_ar_org_papervision3d_core_math_NumberUV object whose coordinate values are specified by the u and v parameters. If you call this constructor function without parameters, a student_ar_org_papervision3d_core_math_NumberUV with u and v properties set to zero is created. * * @param u The horizontal coordinate value. The default value is zero. * @param v The vertical coordinate value. The default value is zero. */ public function student_ar_org_papervision3d_core_math_NumberUV( u: Number=0, v: Number=0 ) { this.u = u; this.v = v; } /** * Returns a new student_ar_org_papervision3d_core_math_NumberUV object that is a clone of the original instance with the same UV values. * * @return A new student_ar_org_papervision3d_core_math_NumberUV instance with the same UV values as the original student_ar_org_papervision3d_core_math_NumberUV instance. */ public function clone():student_ar_org_papervision3d_core_math_NumberUV { return new student_ar_org_papervision3d_core_math_NumberUV( this.u, this.v ); } /** * Returns a student_ar_org_papervision3d_core_math_NumberUV object with u and v properties set to zero. * * @return A student_ar_org_papervision3d_core_math_NumberUV object. */ static public function get ZERO():student_ar_org_papervision3d_core_math_NumberUV { return new student_ar_org_papervision3d_core_math_NumberUV( 0, 0 ); } /** * Returns a string value representing the UV values in the specified student_ar_org_papervision3d_core_math_NumberUV object. * * @return A string. */ public function toString(): String { return 'u:' + u + ' v:' + v; } public static function weighted(a:student_ar_org_papervision3d_core_math_NumberUV, b:student_ar_org_papervision3d_core_math_NumberUV, aw:Number, bw:Number):student_ar_org_papervision3d_core_math_NumberUV { if (a == null) return null; if (b == null) return null; var d:Number = aw + bw; var ak:Number = aw / d; var bk:Number = bw / d; return new student_ar_org_papervision3d_core_math_NumberUV(a.u*ak+b.u*bk, a.v*ak + b.v*bk); } public static function median(a:student_ar_org_papervision3d_core_math_NumberUV, b:student_ar_org_papervision3d_core_math_NumberUV):student_ar_org_papervision3d_core_math_NumberUV { if (a == null) return null; if (b == null) return null; return new student_ar_org_papervision3d_core_math_NumberUV((a.u + b.u)/2, (a.v + b.v)/2); } } }