public static int contains(final DoublePolygon[] triangles, final Point2f pt) { int ct = -1; for (int k = 0; k < triangles.length; k++) { // Here, we can actually give out all the local variables except the BGR, // the BGR is not shape based and will be given by function VO_LoadTexturesFromShapes() if( triangles[k].contains(pt.x, pt.y) ) { ct = k; break; } } return ct; }
/** Constructor to create a VO_Triangle2D object with three coordinate vertexes in vector format */ public VO_Triangle2D(final Point2f[] iVertexes) { super(iVertexes); if(this.m_MatShape[0].length != 3) { System.out.println( "This is not a triangle!"); System.out.println( "Please ensure the shape has 3 columns"); System.exit(1); } if(this.m_MatShape.length != 2) { System.out.println( "This triangle is not in 2D!"); System.exit(1); } this.m_dD = this.Calc_dD (); }
public static int IsPointInTriangles(final Point2f pt, final VO_Triangle2DStructure[] triangles) { int NbOfTriangles = triangles.length; DoublePolygon[] dps = new DoublePolygon[NbOfTriangles]; int npoints = 3; double[] xpoints = new double[npoints]; double[] ypoints = new double[npoints]; for(int i = 0; i < NbOfTriangles; i++) { xpoints[0] = triangles[i].GetA2DPoint(0).x; xpoints[1] = triangles[i].GetA2DPoint(1).x; xpoints[2] = triangles[i].GetA2DPoint(2).x; ypoints[0] = triangles[i].GetA2DPoint(0).y; ypoints[1] = triangles[i].GetA2DPoint(1).y; ypoints[2] = triangles[i].GetA2DPoint(2).y; dps[i] = new DoublePolygon(xpoints, ypoints, 3); } return (com.visionopen.jiapei.utils.Common.contains(dps, pt)); }
public ImageData GetCurrentShapeImageData() { currentShape = new VO_Shape(m_CurrentAlignedShape); currentShape.Scale(m_appearanceModel.m_fAverageShapeSize); float[] sm = com.visionopen.jiapei.utils.Common.Neg(currentShape.Min()); currentShape.Translate(sm); Rectangle rect = currentShape.GetShapeBoundRect(); shapeImageData = new ImageData(rect.width, rect.height, templateImageData.depth, palette); Point2f pt = new Point2f(); int NbOfPoints = currentShape.GetNbOfPoints(); for(int i = 0; i < NbOfPoints; i++) { pt = currentShape.GetA2DPoint(i); shapeImageData.setPixel((int)pt.x, (int)pt.y, 0xFFFFFF); } return shapeImageData; }
/** * Sets this sound's distance gain attenuation - where gain scale factor * is applied to sound based on distance listener is from sound source. * @param distance attenuation pairs of (distance,gain-scale-factor) */ void setDistanceGain(Point2f[] attenuation) { // if attenuation array null set both attenuation components to null if (attenuation == null) { this.attenuationDistance = null; this.attenuationGain = null; // QUESTION: is this needed so that dispatch***() doesn't // fail with null? return; } int attenuationLength = attenuation.length; this.attenuationDistance = new float[attenuationLength]; this.attenuationGain = new float[attenuationLength]; for (int i = 0; i < attenuationLength; i++) { this.attenuationDistance[i] = attenuation[i].x; this.attenuationGain[i] = attenuation[i].y; } dispatchAttribChange(DISTANCE_GAIN_DIRTY_BIT, attenuation); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
/** * Retieves sound's distance attenuation * Put the contents of the two separate distance and gain arrays into * an array of Point2f. * @param attenuation containing distance attenuation pairs */ void getDistanceGain(Point2f[] attenuation) { // write into arrays passed in, don't do a new if (attenuation == null) return; if (this.attenuationDistance == null || this.attenuationGain == null) return; int attenuationLength = attenuation.length; // attenuationDistance and Gain array lengths should be the same int distanceLength = this.attenuationDistance.length; if (distanceLength > attenuationLength) distanceLength = attenuationLength; for (int i=0; i< distanceLength; i++) { attenuation[i].x = attenuationDistance[i]; attenuation[i].y = attenuationGain[i]; } }
/** * Set Distance Filter (based on distances and frequency cutoff) * @param attenuation array of pairs defining distance frequency cutoff */ synchronized void setDistanceFilter(Point2f[] attenuation) { if (attenuation == null) { this.filterType = NO_FILTERING; return; } int attenuationLength = attenuation.length; if (attenuationLength == 0) { this.filterType = NO_FILTERING; return; } this.filterType = LOW_PASS; // Reallocate every time unless size of new array equal old array if ( distance == null || (distance != null && (distance.length != attenuationLength) ) ) { this.distance = new float[attenuationLength]; this.frequencyCutoff = new float[attenuationLength]; } for (int i = 0; i< attenuationLength; i++) { this.distance[i] = attenuation[i].x; this.frequencyCutoff[i] = attenuation[i].y; } this.aaDirty = true; notifyUsers(); }
/** * Retrieve Distance Filter (distances and frequency cutoff) * @return attenaution pairs of distance and frequency cutoff filter */ void getDistanceFilter(Point2f[] attenuation) { // Write into existing param array already allocated if (attenuation == null) return; if (this.distance == null || this.frequencyCutoff == null) return; // The two filter attenuation arrays length should be the same // We can assume that distance and filter lengths are the same // and are non-zero. int distanceLength = this.distance.length; // check that attenuation array large enough to contain // auralAttribute arrays if (distanceLength > attenuation.length) distanceLength = attenuation.length; for (int i=0; i< distanceLength; i++) { attenuation[i].x = this.distance[i]; if (filterType == NO_FILTERING) attenuation[i].y = Sound.NO_FILTER; else if (filterType == LOW_PASS) attenuation[i].y = this.frequencyCutoff[i]; if (debugFlag) debugPrint("AAR: getDistF: " + attenuation[i].x + ", " + attenuation[i].y); } }
/** * Retieves sound's back distance attenuation * Put the contents of the two separate distance and gain arrays into * an array of Point2f. * @param attenuation containing distance attenuation pairs */ void getBackDistanceGain(Point2f[] attenuation) { // Write into arrays passed in, don't do a new if (attenuation == null) return; if (this.backAttenuationDistance == null || this.backAttenuationGain == null) return; // These two array length should be the same // can assume lengths are non-zero int distanceLength = this.backAttenuationDistance.length; int attenuationLength = attenuation.length; if (distanceLength < attenuationLength) distanceLength = attenuationLength; for (int i=0; i< distanceLength; i++) { attenuation[i].x = this.backAttenuationDistance[i]; attenuation[i].y = this.backAttenuationGain[i]; } }
/** * Constructs and initializes a new AuralAttributes object using specified * parameters including an array of Point2f for the distanceFilter. * @param gain amplitude scale factor * @param rolloff atmospheric (changing speed of sound) scale factor * @param reflectionCoefficient reflective/absorptive factor applied to reflections * @param reverbDelay delay time before start of reverberation * @param reverbOrder limit to number of reflections added to reverb signal * @param distanceFilter frequency cutoff * @param frequencyScaleFactor applied to change of pitch * @param velocityScaleFactor applied to velocity of sound in relation to listener */ public AuralAttributes(float gain, float rolloff, float reflectionCoefficient, float reverbDelay, int reverbOrder, Point2f[] distanceFilter, float frequencyScaleFactor, float velocityScaleFactor) { // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((AuralAttributesRetained)this.retained).setAttributeGain(gain); ((AuralAttributesRetained)this.retained).setRolloff(rolloff); ((AuralAttributesRetained)this.retained).setReflectionCoefficient( reflectionCoefficient); ((AuralAttributesRetained)this.retained).setReverbDelay(reverbDelay); ((AuralAttributesRetained)this.retained).setReverbOrder(reverbOrder); ((AuralAttributesRetained)this.retained).setDistanceFilter( distanceFilter); ((AuralAttributesRetained)this.retained).setFrequencyScaleFactor( frequencyScaleFactor); ((AuralAttributesRetained)this.retained).setVelocityScaleFactor( velocityScaleFactor); }
/** * Construct a PointSound object accepting Point3f as input for the position * and accepting an array of Point2f for the distance attenuation values * where each pair in the array contains a distance and a gain scale factor. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param loopCount number of times loop is looped * @param release flag denoting playing sound data to end * @param continuous denotes that sound silently plays when disabled * @param enable sound switched on/off * @param region scheduling bounds * @param priority playback ranking value * @param position 3D location of source * @param distanceGain array of (distance,gain) pairs controling attenuation */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, Point3f position, Point2f[] distanceGain) { super(soundData, initialGain, loopCount, release, continuous, enable, region, priority ); // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((PointSoundRetained)this.retained).setPosition(position); ((PointSoundRetained)this.retained).setDistanceGain(distanceGain); }
/** * Construct a PointSound object accepting individual float parameters for * the elements of the position point, and accepting an array of Point2f for * the distance attenuation values where each pair in the array contains a * distance and a gain scale factor. * @param soundData sound data associated with this sound source node * @param initialGain amplitude scale factor applied to sound source * @param loopCount number of times loop is looped * @param release flag denoting playing sound to end * @param continuous denotes that sound silently plays when disabled * @param enable sound switched on/off * @param region scheduling bounds * @param priority playback ranking value * @param posX x coordinate of location of source * @param posY y coordinate of location of source * @param posZ z coordinate of location of source * @param distanceGain array of (distance,gain) pairs controling attenuation */ public PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, float posX, float posY, float posZ, Point2f[] distanceGain) { super(soundData, initialGain, loopCount, release, continuous, enable, region, priority ); // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((PointSoundRetained)this.retained).setPosition(posX,posY,posZ); ((PointSoundRetained)this.retained).setDistanceGain(distanceGain); }
public boolean deserializeCommand(String data) { startScaleFactor = new Point2f(); endScaledFactor = new Point2f(); String[] tokens = data.split(TestDemultiplexerConstants.SERIAL_SEPARATOR); if (tokens.length != NUM_SERIAL_TOKENS) { return false; } else if (!tokens[0].equals(SERIALIZED_KEY)) { return false; } this.startScaleFactor.set( Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2])); this.endScaledFactor.set( Float.parseFloat(tokens[3]), Float.parseFloat(tokens[4])); this.ms = Long.parseLong(tokens[5]); return true; }
public SomaticContext(SomaticContext state) { frames = new EnumMap<Frames, FrameState>(Frames.class); for (Frames frame : state.frames.keySet()) frames.put(frame, state.frames.get(frame).clone()); robot = state.robot; com = new Vector3f(state.com); bodyPosture = new Matrix3f(state.bodyPosture); bodyHeight = state.bodyHeight; confidence = state.confidence; time = state.time; leftOnGround = state.leftOnGround; rightOnGround = state.rightOnGround; leftPressure = state.leftPressure; rightPressure = state.rightPressure; leftCOP = new Point2f(state.leftCOP); rightCOP = new Point2f(state.rightCOP); cop = new Point2f(state.cop); }
/** * ボールをトラッキングします. * * makemotion_headが発行されればtrueを返し,ボールが見つからない場合はfalseを返します. * * @return */ private boolean trackBall() { VisualObject vo = context.getBall().getVision(); if (vo.confidence > BALLCONF_THRESHOLD) { Point2f angle = vo.angle; float dx = -angle.getX(); float dy = -angle.getY(); float kpTh = 0.25f; float kpGain = 0.25f; if (Math.abs(dx) > kpTh) dx -= Math.copySign(kpTh * kpGain, dx); else dx *= kpGain; if (Math.abs(dy) > kpTh) dy -= Math.copySign(kpTh * kpGain, dy); else dy *= kpGain; context.makemotion_head_rel(dx, dy, 200); return true; } return false; }
private boolean trackGoal(VisualObject goal) { if (goal.confidence > GOALCONF_THRESHOLD) { Point2f angle = goal.angle; float dx = -angle.getX(); float dy = -angle.getY(); float kpTh = 0.25f; float kpGain = 0.4f; if (Math.abs(dx) > kpTh) dx -= Math.copySign(kpTh * kpGain, dx); else dx *= kpGain; if (Math.abs(dy) > kpTh) dy -= Math.copySign(kpTh * kpGain, dy); else dy *= kpGain; context.makemotion_head_rel(dx, dy, 200); return true; } return false; }
public void testAngle2carthesian() { float angleX = (float) Math.toRadians(45); float angleY = (float) Math.toRadians(45); float d = 100.0f; Vector3f v = new Vector3f(); Point2f p = new Point2f(angleX, angleY); System.out.println(p); Coordinates.angle2carthesian(d, p, v); // assertEquals(d, v.length(), 0.001); System.out.println(v); Coordinates.carthesian2angle(v, p); // assertEquals(new Vector3f(d, angleX, angleY), v); System.out.println(p); Vector3f polar = new Vector3f(); Coordinates.carthesian2polar(v, polar); System.out.println(polar); }
/** Default constructor to create a VO_WarpingPoint object */ public VO_WarpingPoint() { this.m_CVPosition = new Point2f(0.0f, 0.0f); this.m_iTriangleIndex = 0; this.m_iPointIndex = 0; this.m_VOTriangle2DStructure = null; this.m_Gradients = null; this.m_Jacobian_One = null; this.m_JacobianMatrix4ShapeModel = null; this.m_JacobianMatrix4GlobalShapeNorm = null; this.m_SteepestDescentImages4ShapeModel = null; this.m_SteepestDescentImages4GlobalShapeNorm = null; }
public Point2f GetLeftTop() { Point2f res = new Point2f(); res.x = MinX(); res.y = MinY(); return res; }
public Point2f GetRightBottom() { Point2f res = new Point2f(); res.x = MaxX(); res.y = MaxY(); return res; }
public Point2f GetLeftBottom() { Point2f res = new Point2f(); res.x = MinX(); res.y = MaxY(); return res; }
public Point2f GetRightTop() { Point2f res = new Point2f(); res.x = MaxX(); res.y = MinY(); return res; }
/** Get 2D points */ public Point2f[] Get2DPoints() { int NbOfPoints = this.m_MatShape[0].length; Point2f[] res = new Point2f[NbOfPoints]; for(int i = 0; i < NbOfPoints; i++) { res[i] = new Point2f(); res[i].x = this.m_MatShape[0][i]; res[i].y = this.m_MatShape[1][i]; } return res; }
/** Set a 2D point */ public void SetA2DPoint(final Point2f pt, int idx) { assert (this.m_MatShape.length == 2); this.m_MatShape[0][idx] = pt.x; this.m_MatShape[1][idx] = pt.y; }
/** Constructor to create a VO_Triangle2DStructure object with three coordinate vertexes and three corresponding vertex indexes in vector format */ public VO_Triangle2DStructure( final Point2f[] iVertexes, final int[] iVertexIndexes ) { super(iVertexes); assert (iVertexIndexes.length == 3); this.m_vVertexIndexes = iVertexIndexes; }
/** VO_Triangle2DStructure to Mat_<float> */ public static VO_Shape Triangle2D2Shape(final VO_Triangle2DStructure[] triangles) { int[] vi4oneTriangle = new int[3]; Vector<Integer> countedIdx = new Vector<Integer>(); Vector<Point2f> ptList = new Vector<Point2f>(); for(int i = 0; i < triangles.length; ++i) { vi4oneTriangle = triangles[i].GetVertexIndexes(); for(int j = 0; j < 3; ++j) { if( !com.visionopen.jiapei.utils.Common.IsContaining(countedIdx, vi4oneTriangle[j]) ) { countedIdx.addElement(vi4oneTriangle[j]); ptList.addElement( triangles[i].GetA2DPoint(j) ); } } } int NbOfPoints = ptList.size(); float[][] mat = new float[2][NbOfPoints]; for(int i = 0; i < NbOfPoints; ++i) { mat[0][i] = ptList.get(i).x; mat[1][i] = ptList.get(i).y; } return new VO_Shape(mat); }
public VO_Shape2D(final ArrayList<Point2f> pointList) { int plSize = pointList.size(); this.m_MatShape = new float[2][plSize]; for(int i = 0; i < plSize; i++) { this.m_MatShape[0][i] = (float)pointList.get(i).getX(); this.m_MatShape[1][i] = (float)pointList.get(i).getY(); } }
public VO_Shape2D(final Point2f[] points) { int plSize = points.length; this.m_MatShape = new float[2][plSize]; for(int i = 0; i < plSize; i++) { this.m_MatShape[0][i] = (float)points[i].getX(); this.m_MatShape[1][i] = (float)points[i].getY(); } }
/**Calculate point warping information */ public static int VO_CalcPointWarpingInfo(final VO_Triangle2DStructure[] templateTriangles, VO_WarpingPoint[] warpInfo) { Vector<VO_WarpingPoint> vec = null; int NbOfPixels = 0; Rectangle rect = VO_TextureModel.VO_CalcBoundingRectFromTriangles(templateTriangles); for (int i = 0; i < rect.height; i++) { for (int j = 0; j < rect.width; j++) { // JIA Pei. 2006-11-25. You will see the following (int) is very important // without (int), the result here is not correct at all!! Point2f pt = new Point2f((float)j, (float)i); int k = VO_Triangle2DStructure.IsPointInTriangles(pt,templateTriangles); if(k>=0) { VO_WarpingPoint tempPixelTriangle = new VO_WarpingPoint(); // necessary for all methods tempPixelTriangle.SetPosition(pt); tempPixelTriangle.SetTriangleIndex(k); tempPixelTriangle.SetPointIndex(NbOfPixels); tempPixelTriangle.SetTriangle2DStructure(templateTriangles[k ] ); // Very important!! Note by JIA Pei, push_back cannot perform on 2-D vectors vec.add (tempPixelTriangle); // warpInfo.push_back (tempPixelTriangle); NbOfPixels ++; } } } warpInfo = (VO_WarpingPoint[]) vec.toArray(); return NbOfPixels; }
/** Put a shape onto iImg and obtaining oImg, without the edge information */ public static void VO_PutShapeOnTemplateFace(final VO_Shape iShape, final ImageData iImg, ImageData oImg) { int NbOfPoints = iShape.GetNbOfPoints(); oImg = (ImageData) iImg.clone(); Point2f pt; for(int i = 0; i < NbOfPoints; i++) { pt = iShape.GetA2DPoint(i); oImg.setPixel( (int)pt.x, (int)pt.y, 0xFF); } }
public static Point2f[] allocPoint2fArray(int size) { final Point2f[] result = new Point2f[size]; for (int i = 0; i < size; i++) { result[i] = new Point2f(); } return result; }
public static int getFirstPtAfter( ArrayList<Point2f> data , float depth ) { if( data.size( ) == 0 ) { return -2; } if( depth > data.get( data.size( ) - 1 ).x ) { return -1; } int lb = 0 , ub = data.size( ); while( ub > lb + 1 ) { final int mid = ( lb + ub ) >> 1; if( data.get( mid ).getX( ) < depth ) { lb = mid; } else { ub = mid; } } if( data.get( lb ).getX( ) >= depth ) { return lb; } else { return ub; } }
public static int getFirstPtBefore( ArrayList<Point2f> data , float depth ) { if( data.size( ) == 0 ) { return -2; } if( depth < data.get( 0 ).x ) { return -1; } int lb = 0 , ub = data.size( ) - 1; while( ub > lb + 1 ) { final int mid = ( lb + ub ) >> 1; if( data.get( mid ).getX( ) < depth ) { lb = mid; } else { ub = mid; } } if( data.get( ub ).getX( ) <= depth ) { return ub; } else { return lb; } }
/** * Transforms a collection of depth/offset points on the sweep into 3D world coordinates, storing them in the result collection. The result must be the same * size as the data and contain no null elements. * * @return whether the operation was successful or not. */ public void apply( ICurveWithNormals3f sweep , Point2f data[] , float lateralOffset , float angle , Point3f trans[] ) { if( data.length != trans.length ) { throw new IllegalArgumentException( "result must be the same size as data" ); } for( int i = 0 ; i < data.length ; i++ ) { apply( sweep , data[ i ].x , data[ i ].y + lateralOffset , angle , trans[ i ] ); } }
/** * Sets this sound's distance gain given separate arrays. * applied to sound based on distance listener is from sound source. * @param distance array of monotonically-increasing floats. * @param gain array of amplitude scale factors associated with distances. */ void setDistanceGain(float[] distance, float[] gain) { // if distance or gain arrays are null then treat both as null if (distance == null) { this.attenuationDistance = null; this.attenuationGain = null; // QUESTION: is this needed so that dispatch***() doesn't // fail with null? return; } int gainLength = gain.length; int distanceLength = distance.length; this.attenuationDistance = new float[distanceLength]; this.attenuationGain = new float[distanceLength]; // Copy the distance array into nodes field System.arraycopy(distance, 0, this.attenuationDistance, 0, distanceLength); // Copy the gain array an array of same length as the distance array if (distanceLength <= gainLength) { System.arraycopy(gain, 0, this.attenuationGain, 0, distanceLength); } else { System.arraycopy(gain, 0, this.attenuationGain, 0, gainLength); // Extend gain array to length of distance array // replicate last gain values. for (int i=gainLength; i< distanceLength; i++) { this.attenuationGain[i] = gain[gainLength - 1]; } } Point2f [] attenuation = new Point2f[distanceLength]; for (int i=0; i<distanceLength; i++) { attenuation[i] = new Point2f(this.attenuationDistance[i], this.attenuationGain[i]); } dispatchAttribChange(DISTANCE_GAIN_DIRTY_BIT, attenuation); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
/** * Sets this sound's back distance gain attenuation - where gain scale * factor is applied to sound based on distance listener along the negative * sound direction axis from sound source. * @param attenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ void setBackDistanceGain(Point2f[] attenuation) { // if attenuation array null set both attenuation components to null if (attenuation == null) { this.backAttenuationDistance = null; this.backAttenuationGain = null; } else { int attenuationLength = attenuation.length; if (attenuationLength == 0) { this.backAttenuationDistance = null; this.backAttenuationGain = null; } else { this.backAttenuationDistance = new float[attenuationLength]; this.backAttenuationGain = new float[attenuationLength]; for (int i = 0; i < attenuationLength; i++) { this.backAttenuationDistance[i] = attenuation[i].x; this.backAttenuationGain[i] = attenuation[i].y; } } } dispatchAttribChange(BACK_DISTANCE_GAIN_DIRTY_BIT, attenuation); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
/** * Sets this sound's angular gain attenuation (not including filter) * @param attenuation array containing angular distance and gain */ void setAngularAttenuation(Point2f[] attenuation) { int attenuationLength = 0; this.filterType = NO_FILTERING; if (attenuation == null) { this.angularDistance = null; this.angularGain = null; } else { attenuationLength = attenuation.length; if (attenuationLength == 0) { this.angularDistance = null; this.angularGain = null; } else { this.angularDistance = new float[attenuationLength]; this.angularGain = new float[attenuationLength]; for (int i = 0; i < attenuationLength; i++) { this.angularDistance[i] = attenuation[i].x; this.angularGain[i] = attenuation[i].y; } } // lengths not zero } // arrays not null Point3f [] attenuation3f = new Point3f[attenuationLength]; for (int i=0; i<attenuationLength; i++) { attenuation3f[i] = new Point3f(this.angularDistance[i], this.angularGain[i], Sound.NO_FILTER); } dispatchAttribChange(ANGULAR_ATTENUATION_DIRTY_BIT, attenuation3f); if (source != null && source.isLive()) { notifySceneGraphChanged(false); } }
/** * Constructs and initializes a new Cone Sound node explicitly setting all * PointSound and ConeSound fields as arguments: the PointSound position, * front and back distance attenuation Point2f array, and ConeSound * direction vector and Point3f angular attenuation. * @param soundData sound source data associated with this node * @param initialGain amplitude scale factor applied to sound * @param loopCount number of times sound is looped * @param release flag denoting playing sound to end * @param continuous denotes that sound silently plays when disabled * @param enable sound switched on/off * @param region scheduling bounds * @param priority playback ranking value * @param position 3D location of source * @param frontDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the positive direction axis * @param backDistanceAttenuation array of (distance,gain) pairs controlling * attenuation values along the negative direction axis * @param direction vector defining cones' axii * @param angularAttenuation array of tuples defining angular gain/filtering */ public ConeSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, Point3f position, Point2f[] frontDistanceAttenuation, Point2f[] backDistanceAttenuation, Vector3f direction, Point3f[] angularAttenuation ) { super(soundData, initialGain, loopCount, release, continuous, enable, region, priority, position, frontDistanceAttenuation ); // set default read capabilities setDefaultReadCapabilities(readCapabilities); ((ConeSoundRetained)this.retained).setBackDistanceGain( backDistanceAttenuation); ((ConeSoundRetained)this.retained).setDirection(direction); ((ConeSoundRetained)this.retained).setAngularAttenuation( angularAttenuation); }
/** * Sets this sound's distance gain elliptical attenuation - * where gain scale factor is applied to sound based on distance listener * is from sound source. * @param frontAttenuation defined by pairs of (distance,gain-scale-factor) * @param backAttenuation defined by pairs of (distance,gain-scale-factor) * @exception CapabilityNotSetException if appropriate capability is * not set and this object is part of live or compiled scene graph */ public void setDistanceGain(Point2f[] frontAttenuation, Point2f[] backAttenuation ) { if (isLiveOrCompiled()) if(!this.getCapability(ALLOW_DISTANCE_GAIN_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("ConeSound0")); ((ConeSoundRetained)this.retained).setDistanceGain(frontAttenuation, backAttenuation); }
/** * Create a new DragCommand. The number of steps interpolated between points * is calculated at 1 steps per 1 unit distance. * @param startXScale Initial x position scale factor (0.0 - 1.0 inclusive). * @param startYScale Initial y position scale factor (0.0 - 1.0 inclusive). * @param endXScale Final x position scale factor (0.0 - 1.0 inclusive). * @param endYScale Final y position scale factor (0.0 - 1.0 inclusive). * @param ms Duration of drag in milliseconds (1000 ms = 1 sec). */ public DragCommand( float startXScale, float startYScale, float endXScale, float endYScale, long ms) { this.startScaleFactor = new Point2f(startXScale, startYScale); this.endScaledFactor = new Point2f(endXScale, endYScale); this.ms = ms; }