diff --git a/js/Shape.ts b/js/Shape.ts index 0f3482d..efd7f14 100644 --- a/js/Shape.ts +++ b/js/Shape.ts @@ -12,7 +12,7 @@ * Notes for elliptical arcs: http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes * Notes for painting strokes: https://svgwg.org/svg2-draft/painting.html * - * TODO: add nonzero / evenodd support when browsers support it https://github.com/phetsims/tasks/issues/1129 + * TODO: add nonzero / evenodd support when browsers support it https://github.com/phetsims/kite/issues/102 * TODO: docs * * @author Jonathan Olson @@ -432,7 +432,7 @@ class Shape implements CanApplyParsedSVG { * Adds a quadratic curve to this shape. The quadratic curves passes through the x and y coordinate. * The shape should join smoothly with the previous subpaths * - * TODO: consider a rename to put 'smooth' farther back? https://github.com/phetsims/tasks/issues/1129 + * TODO: consider a rename to put 'smooth' farther back? https://github.com/phetsims/kite/issues/102 * * @param x - final x position of the quadratic curve * @param y - final y position of the quadratic curve @@ -470,7 +470,7 @@ class Shape implements CanApplyParsedSVG { this.getLastSubpath().addPoint( point ); const nondegenerateSegments = quadratic.getNondegenerateSegments(); _.each( nondegenerateSegments, segment => { - // TODO: optimization https://github.com/phetsims/tasks/issues/1129 + // TODO: optimization https://github.com/phetsims/kite/issues/102 this.addSegmentAndBounds( segment ); } ); this.setQuadraticControlPoint( controlPoint ); @@ -868,8 +868,8 @@ class Shape implements CanApplyParsedSVG { public ellipse( center: Vector2, radiusX: number, radiusY: number, rotation: number ): this; public ellipse( centerX: number, centerY: number, radiusX: number, radiusY: number, rotation: number ): this; public ellipse( centerX: Vector2 | number, centerY: number, radiusX: number, radiusY: number, rotation?: number ): this { - // TODO: separate into ellipse() and ellipsePoint()? https://github.com/phetsims/tasks/issues/1129 - // TODO: Ellipse/EllipticalArc has a mess of parameters. Consider parameter object, or double-check parameter handling https://github.com/phetsims/tasks/issues/1129 + // TODO: separate into ellipse() and ellipsePoint()? https://github.com/phetsims/kite/issues/102 + // TODO: Ellipse/EllipticalArc has a mess of parameters. Consider parameter object, or double-check parameter handling https://github.com/phetsims/kite/issues/102 if ( typeof centerX === 'object' ) { // ellipse( center, radiusX, radiusY, rotation ) const center = centerX; @@ -1093,7 +1093,7 @@ class Shape implements CanApplyParsedSVG { * Returns a new Shape that is transformed by the associated matrix */ public transformed( matrix: Matrix3 ): Shape { - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 const subpaths = _.map( this.subpaths, subpath => subpath.transformed( matrix ) ); const bounds = _.reduce( subpaths, ( bounds, subpath ) => bounds.union( subpath.bounds ), Bounds2.NOTHING ); return new Shape( subpaths, bounds ); @@ -1111,7 +1111,7 @@ class Shape implements CanApplyParsedSVG { curveEpsilon: ( providedOptions && providedOptions.includeCurvature ) ? 0.002 : null }, providedOptions ); - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 const subpaths = _.map( this.subpaths, subpath => subpath.nonlinearTransformed( options ) ); const bounds = _.reduce( subpaths, ( bounds, subpath ) => bounds.union( subpath.bounds ), Bounds2.NOTHING ); return new Shape( subpaths, bounds ); @@ -1236,7 +1236,7 @@ class Shape implements CanApplyParsedSVG { return true; } - // TODO: if an issue, we can reduce this allocation to a scratch variable local in the Shape.js scope. https://github.com/phetsims/tasks/issues/1129 + // TODO: if an issue, we can reduce this allocation to a scratch variable local in the Shape.js scope. https://github.com/phetsims/kite/issues/102 const delta = endPoint.minus( startPoint ); const length = delta.magnitude; @@ -1306,7 +1306,7 @@ class Shape implements CanApplyParsedSVG { let hitPoint; let i; - // TODO: could optimize to intersect differently so we bail sooner https://github.com/phetsims/tasks/issues/1129 + // TODO: could optimize to intersect differently so we bail sooner https://github.com/phetsims/kite/issues/102 const horizontalRayIntersections = this.intersection( minHorizontalRay ).concat( this.intersection( maxHorizontalRay ) ); for ( i = 0; i < horizontalRayIntersections.length; i++ ) { hitPoint = horizontalRayIntersections[ i ].point; @@ -1331,7 +1331,7 @@ class Shape implements CanApplyParsedSVG { * Returns a new Shape that is an outline of the stroked path of this current Shape. currently not intended to be * nested (doesn't do intersection computations yet) * - * TODO: rename stroked( lineStyles )? https://github.com/phetsims/tasks/issues/1129 + * TODO: rename stroked( lineStyles )? https://github.com/phetsims/kite/issues/102 */ public getStrokedShape( lineStyles: LineStyles ): Shape { let subpaths: Subpath[] = []; @@ -1353,7 +1353,7 @@ class Shape implements CanApplyParsedSVG { * Gets a shape offset by a certain amount. */ public getOffsetShape( distance: number ): Shape { - // TODO: abstract away this type of behavior https://github.com/phetsims/tasks/issues/1129 + // TODO: abstract away this type of behavior https://github.com/phetsims/kite/issues/102 const subpaths = []; const bounds = Bounds2.NOTHING.copy(); let subLen = this.subpaths.length; @@ -1570,7 +1570,7 @@ class Shape implements CanApplyParsedSVG { } public toString(): string { - // TODO: consider a more verbose but safer way? https://github.com/phetsims/tasks/issues/1129 + // TODO: consider a more verbose but safer way? https://github.com/phetsims/kite/issues/102 return `new phet.kite.Shape( '${this.getSVGPath()}' )`; } @@ -1739,7 +1739,7 @@ class Shape implements CanApplyParsedSVG { /** * Returns a new shape that only contains portions of segments that are within the passed-in shape's area. * - * // TODO: convert Graph to TS and get the types from there https://github.com/phetsims/tasks/issues/1129 + * // TODO: convert Graph to TS and get the types from there https://github.com/phetsims/kite/issues/102 */ public shapeClip( shape: Shape, options?: { includeExterior?: boolean; includeBoundary: boolean; includeInterior: boolean } ): Shape { return Graph.clipShape( shape, this, options ); @@ -1982,7 +1982,7 @@ class Shape implements CanApplyParsedSVG { public static ellipse( center: Vector2, radiusX: number, radiusY: number, rotation: number ): Shape; public static ellipse( radiusX: number, radiusY: number, rotation: number ): Shape; public static ellipse( a: Vector2 | number, b: number, c: number, d?: number, e?: number ): Shape { - // TODO: Ellipse/EllipticalArc has a mess of parameters. Consider parameter object, or double-check parameter handling https://github.com/phetsims/tasks/issues/1129 + // TODO: Ellipse/EllipticalArc has a mess of parameters. Consider parameter object, or double-check parameter handling https://github.com/phetsims/kite/issues/102 if ( d === undefined ) { // ellipse( radiusX, radiusY ), center = 0,0 return new Shape().ellipse( 0, 0, a as number, b, c ); diff --git a/js/ops/BoundsIntersection.ts b/js/ops/BoundsIntersection.ts index dd7be5a..8cbb50c 100644 --- a/js/ops/BoundsIntersection.ts +++ b/js/ops/BoundsIntersection.ts @@ -250,7 +250,7 @@ export default class BoundsIntersection { } // Subdivide continuously - // TODO: is 50 the proper number of iterations? https://github.com/phetsims/tasks/issues/1129 + // TODO: is 50 the proper number of iterations? https://github.com/phetsims/kite/issues/102 for ( let i = 0; i < 50; i++ ) { const newIntersections: BoundsIntersection[] = []; for ( let j = intersections.length - 1; j >= 0; j-- ) { diff --git a/js/ops/Graph.js b/js/ops/Graph.js index f15b879..7f41ede 100644 --- a/js/ops/Graph.js +++ b/js/ops/Graph.js @@ -8,7 +8,7 @@ * * See Graph.binaryResult for the general procedure for CAG. * - * TODO: Use https://github.com/mauriciosantos/Buckets-JS for priority queue, implement simple sweep line https://github.com/phetsims/tasks/issues/1129 + * TODO: Use https://github.com/mauriciosantos/Buckets-JS for priority queue, implement simple sweep line https://github.com/phetsims/kite/issues/102 * with "enters" and "leaves" entries in the queue. When edge removed, remove "leave" from queue. * and add any replacement edges. Applies to overlap and intersection handling. * NOTE: This should impact performance a lot, as we are currently over-scanning and re-scanning a lot. @@ -550,7 +550,7 @@ class Graph { assert && assert( this.loops.length === 0 ); - // TODO: Can we avoid this in the inner loop? https://github.com/phetsims/tasks/issues/1129 + // TODO: Can we avoid this in the inner loop? https://github.com/phetsims/kite/issues/102 if ( aEdge.startVertex === vertex ) { aSegment = aSegment.reversed(); } @@ -607,7 +607,7 @@ class Graph { const addToQueue = edge => { const bounds = edge.segment.bounds; - // TODO: see if object allocations are slow here https://github.com/phetsims/tasks/issues/1129 + // TODO: see if object allocations are slow here https://github.com/phetsims/kite/issues/102 queue.push( { start: true, edge: edge }, bounds.minY - epsilon ); queue.push( { start: false, edge: edge }, bounds.maxY + epsilon ); }; @@ -643,7 +643,7 @@ class Graph { let overlappedEdge; let addedEdges; - // TODO: Is this closure killing performance? https://github.com/phetsims/tasks/issues/1129 + // TODO: Is this closure killing performance? https://github.com/phetsims/kite/issues/102 segmentTree.query( edge, otherEdge => { const overlaps = edge.segment.getOverlaps( otherEdge.segment ); @@ -833,7 +833,7 @@ class Graph { const segment = edge.segment; if ( segment instanceof Cubic ) { - // TODO: This might not properly handle when it only one endpoint is on the curve https://github.com/phetsims/tasks/issues/1129 + // TODO: This might not properly handle when it only one endpoint is on the curve https://github.com/phetsims/kite/issues/102 const selfIntersection = segment.getSelfIntersection(); if ( selfIntersection ) { @@ -889,7 +889,7 @@ class Graph { const addToQueue = edge => { const bounds = edge.segment.bounds; - // TODO: see if object allocations are slow here https://github.com/phetsims/tasks/issues/1129 + // TODO: see if object allocations are slow here https://github.com/phetsims/kite/issues/102 queue.push( { start: true, edge: edge }, bounds.minY - epsilon ); queue.push( { start: false, edge: edge }, bounds.maxY + epsilon ); }; @@ -926,7 +926,7 @@ class Graph { let addedEdges; let removedEdges; - // TODO: Is this closure killing performance? https://github.com/phetsims/tasks/issues/1129 + // TODO: Is this closure killing performance? https://github.com/phetsims/kite/issues/102 segmentTree.query( edge, otherEdge => { const aSegment = edge.segment; @@ -942,7 +942,7 @@ class Graph { } ); if ( intersections.length ) { - // TODO: In the future, handle multiple intersections (instead of re-running) https://github.com/phetsims/tasks/issues/1129 + // TODO: In the future, handle multiple intersections (instead of re-running) https://github.com/phetsims/kite/issues/102 const intersection = intersections[ 0 ]; const result = this.simpleSplit( edge, otherEdge, intersection.aT, intersection.bT, intersection.point ); @@ -1102,7 +1102,7 @@ class Graph { // Adds an vertex to the queue const addToQueue = vertex => { - // TODO: see if object allocations are slow here https://github.com/phetsims/tasks/issues/1129 + // TODO: see if object allocations are slow here https://github.com/phetsims/kite/issues/102 queue.push( { start: true, vertex: vertex }, vertex.point.y - epsilon ); queue.push( { start: false, vertex: vertex }, vertex.point.y + epsilon ); }; @@ -1138,7 +1138,7 @@ class Graph { let overlappedVertex; let addedVertices; - // TODO: Is this closure killing performance? https://github.com/phetsims/tasks/issues/1129 + // TODO: Is this closure killing performance? https://github.com/phetsims/kite/issues/102 segmentTree.query( vertex, otherVertex => { const distance = vertex.point.distance( otherVertex.point ); if ( distance < VERTEX_COLLAPSE_THRESHOLD_DISTANCE ) { @@ -1377,7 +1377,7 @@ class Graph { * This information is stored in the childBoundaries array of Boundary, and is then read out to set up faces. */ computeBoundaryTree() { - // TODO: detect "indeterminate" for robustness (and try new angles?) https://github.com/phetsims/tasks/issues/1129 + // TODO: detect "indeterminate" for robustness (and try new angles?) https://github.com/phetsims/kite/issues/102 const unboundedHoles = []; // {Array.} // We'll want to compute a ray for each outer boundary that starts at an extreme point for that direction and @@ -1563,7 +1563,7 @@ class Graph { * Returns the boundary that contains the specified half-edge. * @private * - * TODO: find a better way, this is crazy inefficient https://github.com/phetsims/tasks/issues/1129 + * TODO: find a better way, this is crazy inefficient https://github.com/phetsims/kite/issues/102 * * @param {HalfEdge} halfEdge * @returns {Boundary} @@ -1735,7 +1735,7 @@ class Graph { * Returns the xor of an array of shapes. * @public * - * TODO: reduce code duplication? https://github.com/phetsims/tasks/issues/1129 + * TODO: reduce code duplication? https://github.com/phetsims/kite/issues/102 * * @param {Array.} shapes * @returns {Shape} diff --git a/js/segments/Arc.ts b/js/segments/Arc.ts index 43080ac..346e13b 100644 --- a/js/segments/Arc.ts +++ b/js/segments/Arc.ts @@ -13,7 +13,7 @@ import Utils from '../../../dot/js/Utils.js'; import Vector2 from '../../../dot/js/Vector2.js'; import { EllipticalArc, kite, Line, Overlap, RayIntersection, Segment, SegmentIntersection, svgNumber } from '../imports.js'; -// TODO: See if we should use this more https://github.com/phetsims/tasks/issues/1129 +// TODO: See if we should use this more https://github.com/phetsims/kite/issues/102 const TWO_PI = Math.PI * 2; export type SerializedArc = { @@ -260,7 +260,7 @@ export default class Arc extends Segment { return [ this ]; } - // TODO: verify that we don't need to switch anticlockwise here, or subtract 2pi off any angles https://github.com/phetsims/tasks/issues/1129 + // TODO: verify that we don't need to switch anticlockwise here, or subtract 2pi off any angles https://github.com/phetsims/kite/issues/102 const angle0 = this.angleAt( 0 ); const angleT = this.angleAt( t ); const angle1 = this.angleAt( 1 ); @@ -484,7 +484,7 @@ export default class Arc extends Segment { * Returns the angle for the parametrized t value. The t value should range from 0 to 1 (inclusive). */ public angleAt( t: number ): number { - //TODO: add asserts https://github.com/phetsims/tasks/issues/1129 + //TODO: add asserts https://github.com/phetsims/kite/issues/102 return this._startAngle + ( this.getActualEndAngle() - this._startAngle ) * t; } @@ -511,7 +511,7 @@ export default class Arc extends Segment { */ public containsAngle( angle: number ): boolean { // transform the angle into the appropriate coordinate form - // TODO: check anticlockwise version! https://github.com/phetsims/tasks/issues/1129 + // TODO: check anticlockwise version! https://github.com/phetsims/kite/issues/102 const normalizedAngle = this._anticlockwise ? angle - this._endAngle : angle - this._startAngle; // get the angle between 0 and 2pi @@ -591,7 +591,7 @@ export default class Arc extends Segment { _.each( [ 0, Math.PI / 2, Math.PI, 3 * Math.PI / 2 ], angle => { if ( this.containsAngle( angle ) ) { const t = this.tAtAngle( angle ); - const epsilon = 0.0000000001; // TODO: general kite epsilon?, also do 1e-Number format https://github.com/phetsims/tasks/issues/1129 + const epsilon = 0.0000000001; // TODO: general kite epsilon?, also do 1e-Number format https://github.com/phetsims/kite/issues/102 if ( t > epsilon && t < 1 - epsilon ) { result.push( t ); } @@ -682,7 +682,7 @@ export default class Arc extends Segment { /** * Returns a new copy of this arc, transformed by the given matrix. * - * TODO: test various transform types, especially rotations, scaling, shears, etc. https://github.com/phetsims/tasks/issues/1129 + * TODO: test various transform types, especially rotations, scaling, shears, etc. https://github.com/phetsims/kite/issues/102 */ public transformed( matrix: Matrix3 ): Arc | EllipticalArc { // so we can handle reflections in the transform, we do the general case handling for start/end angles @@ -1058,7 +1058,7 @@ export default class Arc extends Segment { const radius = ( startDiff.magnitude + middleDiff.magnitude + endDiff.magnitude ) / 3; - // Try anticlockwise first. TODO: Don't require creation of extra Arcs https://github.com/phetsims/tasks/issues/1129 + // Try anticlockwise first. TODO: Don't require creation of extra Arcs https://github.com/phetsims/kite/issues/102 const arc = new Arc( center, radius, startAngle, endAngle, false ); if ( arc.containsAngle( middleAngle ) ) { return arc; diff --git a/js/segments/Cubic.ts b/js/segments/Cubic.ts index 15cbb7e..9a8a0e0 100644 --- a/js/segments/Cubic.ts +++ b/js/segments/Cubic.ts @@ -253,7 +253,7 @@ export default class Cubic extends Segment { assert && assert( t <= 1, 'curvatureAt t should be no greater than 1' ); // see http://cagd.cs.byu.edu/~557/text/ch2.pdf p31 - // TODO: remove code duplication with Quadratic https://github.com/phetsims/tasks/issues/1129 + // TODO: remove code duplication with Quadratic https://github.com/phetsims/kite/issues/102 const epsilon = 0.0000001; if ( Math.abs( t - 0.5 ) > 0.5 - epsilon ) { const isZero = t < 0.5; @@ -286,7 +286,7 @@ export default class Cubic extends Segment { } // de Casteljau method - // TODO: add a 'bisect' or 'between' method for vectors? https://github.com/phetsims/tasks/issues/1129 + // TODO: add a 'bisect' or 'between' method for vectors? https://github.com/phetsims/kite/issues/102 const left = this._start.blend( this._control1, t ); const right = this._control2.blend( this._end, t ); const middle = this._control1.blend( this._control2, t ); @@ -360,7 +360,7 @@ export default class Cubic extends Segment { public get endTangent(): Vector2 { return this.getEndTangent(); } /** - * TODO: documentation https://github.com/phetsims/tasks/issues/1129 + * TODO: documentation https://github.com/phetsims/kite/issues/102 */ public getR(): Vector2 { // from http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf @@ -373,7 +373,7 @@ export default class Cubic extends Segment { public get r(): Vector2 { return this.getR(); } /** - * TODO: documentation https://github.com/phetsims/tasks/issues/1129 + * TODO: documentation https://github.com/phetsims/kite/issues/102 */ public getS(): Vector2 { // from http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf @@ -509,7 +509,7 @@ export default class Cubic extends Segment { */ private computeCuspInfo(): void { // from http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 const a = this._start.times( -1 ).plus( this._control1.times( 3 ) ).plus( this._control2.times( -3 ) ).plus( this._end ); const b = this._start.times( 3 ).plus( this._control1.times( -6 ) ).plus( this._control2.times( 3 ) ); const c = this._start.times( -3 ).plus( this._control1.times( 3 ) ); @@ -609,7 +609,7 @@ export default class Cubic extends Segment { public hasCusp(): boolean { const tCusp = this.getTCusp(); - const epsilon = 1e-7; // TODO: make this available to change? https://github.com/phetsims/tasks/issues/1129 + const epsilon = 1e-7; // TODO: make this available to change? https://github.com/phetsims/kite/issues/102 return tCusp >= 0 && tCusp <= 1 && this.tangentAt( tCusp ).magnitude < epsilon; } @@ -619,8 +619,8 @@ export default class Cubic extends Segment { } public offsetTo( r: number, reverse: boolean ): Line[] { - // TODO: implement more accurate method at http://www.antigrain.com/research/adaptive_bezier/index.html https://github.com/phetsims/tasks/issues/1129 - // TODO: or more recently (and relevantly): http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf https://github.com/phetsims/tasks/issues/1129 + // TODO: implement more accurate method at http://www.antigrain.com/research/adaptive_bezier/index.html https://github.com/phetsims/kite/issues/102 + // TODO: or more recently (and relevantly): http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf https://github.com/phetsims/kite/issues/102 // how many segments to create (possibly make this more adaptive?) const quantity = 32; @@ -687,7 +687,7 @@ export default class Cubic extends Segment { const ts = this.getXExtremaT().concat( this.getYExtremaT() ); const result: number[] = []; _.each( ts, t => { - const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/tasks/issues/1129 + const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/kite/issues/102 if ( t > epsilon && t < 1 - epsilon ) { // don't add duplicate t values if ( _.every( result, otherT => Math.abs( t - otherT ) > epsilon ) ) { @@ -1049,7 +1049,7 @@ export default class Cubic extends Segment { const qt0 = b; const qt1 = a + b; - // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/tasks/issues/1129 + // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/kite/issues/102 if ( ( qt0 > 1 && qt1 > 1 ) || ( qt0 < 0 && qt1 < 0 ) ) { return noOverlap; } diff --git a/js/segments/EllipticalArc.ts b/js/segments/EllipticalArc.ts index fe0988e..93f6c66 100644 --- a/js/segments/EllipticalArc.ts +++ b/js/segments/EllipticalArc.ts @@ -335,7 +335,7 @@ export default class EllipticalArc extends Segment { return [ this ]; } - // TODO: verify that we don't need to switch anticlockwise here, or subtract 2pi off any angles https://github.com/phetsims/tasks/issues/1129 + // TODO: verify that we don't need to switch anticlockwise here, or subtract 2pi off any angles https://github.com/phetsims/kite/issues/102 const angle0 = this.angleAt( 0 ); const angleT = this.angleAt( t ); const angle1 = this.angleAt( 1 ); @@ -404,7 +404,7 @@ export default class EllipticalArc extends Segment { } if ( this._radiusX < this._radiusY ) { - // TODO: check this https://github.com/phetsims/tasks/issues/1129 + // TODO: check this https://github.com/phetsims/kite/issues/102 throw new Error( 'Not verified to work if radiusX < radiusY' ); } @@ -608,7 +608,7 @@ export default class EllipticalArc extends Segment { /** * Maps a contained angle to between [startAngle,actualEndAngle), even if the end angle is lower. * - * TODO: remove duplication with Arc https://github.com/phetsims/tasks/issues/1129 + * TODO: remove duplication with Arc https://github.com/phetsims/kite/issues/102 */ public mapAngle( angle: number ): number { if ( Math.abs( Utils.moduloBetweenDown( angle - this._startAngle, -Math.PI, Math.PI ) ) < 1e-8 ) { @@ -626,7 +626,7 @@ export default class EllipticalArc extends Segment { /** * Returns the parametrized value t for a given angle. The value t should range from 0 to 1 (inclusive). * - * TODO: remove duplication with Arc https://github.com/phetsims/tasks/issues/1129 + * TODO: remove duplication with Arc https://github.com/phetsims/kite/issues/102 */ public tAtAngle( angle: number ): number { return ( this.mapAngle( angle ) - this._startAngle ) / ( this.getActualEndAngle() - this._startAngle ); @@ -758,7 +758,7 @@ export default class EllipticalArc extends Segment { _.each( this.possibleExtremaAngles, ( angle: number ) => { if ( this.unitArcSegment.containsAngle( angle ) ) { const t = this.tAtAngle( angle ); - const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/tasks/issues/1129 + const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/kite/issues/102 if ( t > epsilon && t < 1 - epsilon ) { result.push( t ); } @@ -822,7 +822,7 @@ export default class EllipticalArc extends Segment { const reflected = matrix.getDeterminant() < 0; // reverse the 'clockwiseness' if our transform includes a reflection - // TODO: check reflections. swapping angle signs should fix clockwiseness https://github.com/phetsims/tasks/issues/1129 + // TODO: check reflections. swapping angle signs should fix clockwiseness https://github.com/phetsims/kite/issues/102 const anticlockwise = reflected ? !this._anticlockwise : this._anticlockwise; const startAngle = reflected ? -this._startAngle : this._startAngle; let endAngle = reflected ? -this._endAngle : this._endAngle; diff --git a/js/segments/Line.ts b/js/segments/Line.ts index fac49a5..14ffd9f 100644 --- a/js/segments/Line.ts +++ b/js/segments/Line.ts @@ -189,7 +189,7 @@ export default class Line extends Segment { */ public getStartTangent(): Vector2 { if ( this._tangent === null ) { - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 this._tangent = this._end.minus( this._start ).normalized(); } return this._tangent; @@ -211,7 +211,7 @@ export default class Line extends Segment { * Returns the bounds of this segment. */ public getBounds(): Bounds2 { - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 if ( this._bounds === null ) { this._bounds = Bounds2.NOTHING.copy().addPoint( this._start ).addPoint( this._end ); } @@ -582,7 +582,7 @@ export default class Line extends Segment { const qt0 = b; const qt1 = a + b; - // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/tasks/issues/1129 + // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/kite/issues/102 if ( ( qt0 > 1 && qt1 > 1 ) || ( qt0 < 0 && qt1 < 0 ) ) { return noOverlap; } diff --git a/js/segments/Quadratic.ts b/js/segments/Quadratic.ts index ef80450..61ae1d4 100644 --- a/js/segments/Quadratic.ts +++ b/js/segments/Quadratic.ts @@ -152,7 +152,7 @@ export default class Quadratic extends Segment { const mt = 1 - t; // described from t=[0,1] as: (1-t)^2 start + 2(1-t)t control + t^2 end - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 return this._start.times( mt * mt ).plus( this._control.times( 2 * mt * t ) ).plus( this._end.times( t * t ) ); } @@ -169,7 +169,7 @@ export default class Quadratic extends Segment { assert && assert( t <= 1, 'tangentAt t should be no greater than 1' ); // For a quadratic curve, the derivative is given by : 2(1-t)( control - start ) + 2t( end - control ) - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 return this._control.minus( this._start ).times( 2 * ( 1 - t ) ).plus( this._end.minus( this._control ).times( 2 * t ) ); } @@ -189,7 +189,7 @@ export default class Quadratic extends Segment { assert && assert( t <= 1, 'curvatureAt t should be no greater than 1' ); // see http://cagd.cs.byu.edu/~557/text/ch2.pdf p31 - // TODO: remove code duplication with Cubic https://github.com/phetsims/tasks/issues/1129 + // TODO: remove code duplication with Cubic https://github.com/phetsims/kite/issues/102 const epsilon = 0.0000001; if ( Math.abs( t - 0.5 ) > 0.5 - epsilon ) { const isZero = t < 0.5; @@ -260,7 +260,7 @@ export default class Quadratic extends Segment { public getStartTangent(): Vector2 { if ( this._startTangent === null ) { const controlIsStart = this._start.equals( this._control ); - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 this._startTangent = controlIsStart ? this._end.minus( this._start ).normalized() : this._control.minus( this._start ).normalized(); @@ -276,7 +276,7 @@ export default class Quadratic extends Segment { public getEndTangent(): Vector2 { if ( this._endTangent === null ) { const controlIsEnd = this._end.equals( this._control ); - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 this._endTangent = controlIsEnd ? this._end.minus( this._start ).normalized() : this._end.minus( this._control ).normalized(); @@ -395,8 +395,8 @@ export default class Quadratic extends Segment { * @param reverse */ public offsetTo( r: number, reverse: boolean ): Quadratic[] { - // TODO: implement more accurate method at http://www.antigrain.com/research/adaptive_bezier/index.html https://github.com/phetsims/tasks/issues/1129 - // TODO: or more recently (and relevantly): http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf https://github.com/phetsims/tasks/issues/1129 + // TODO: implement more accurate method at http://www.antigrain.com/research/adaptive_bezier/index.html https://github.com/phetsims/kite/issues/102 + // TODO: or more recently (and relevantly): http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf https://github.com/phetsims/kite/issues/102 let curves: Quadratic[] = [ this ]; // subdivide this curve @@ -419,7 +419,7 @@ export default class Quadratic extends Segment { * Elevation of this quadratic Bezier curve to a cubic Bezier curve */ public degreeElevated(): Cubic { - // TODO: allocation reduction https://github.com/phetsims/tasks/issues/1129 + // TODO: allocation reduction https://github.com/phetsims/kite/issues/102 return new Cubic( this._start, this._start.plus( this._control.timesScalar( 2 ) ).dividedScalar( 3 ), @@ -475,9 +475,9 @@ export default class Quadratic extends Segment { } public getInteriorExtremaTs(): number[] { - // TODO: we assume here we are reduce, so that a criticalX doesn't equal a criticalY? https://github.com/phetsims/tasks/issues/1129 + // TODO: we assume here we are reduce, so that a criticalX doesn't equal a criticalY? https://github.com/phetsims/kite/issues/102 const result = []; - const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/tasks/issues/1129 + const epsilon = 0.0000000001; // TODO: general kite epsilon? https://github.com/phetsims/kite/issues/102 const criticalX = this.getTCriticalX(); const criticalY = this.getTCriticalY(); @@ -752,7 +752,7 @@ export default class Quadratic extends Segment { const qt0 = b; const qt1 = a + b; - // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/tasks/issues/1129 + // TODO: do we want an epsilon in here to be permissive? https://github.com/phetsims/kite/issues/102 if ( ( qt0 > 1 && qt1 > 1 ) || ( qt0 < 0 && qt1 < 0 ) ) { return noOverlap; } diff --git a/js/segments/Segment.ts b/js/segments/Segment.ts index e50b572..47f9f12 100644 --- a/js/segments/Segment.ts +++ b/js/segments/Segment.ts @@ -181,7 +181,7 @@ export default abstract class Segment { } /** - * TODO: override everywhere so this isn't necessary (it's not particularly efficient!) https://github.com/phetsims/tasks/issues/1129 + * TODO: override everywhere so this isn't necessary (it's not particularly efficient!) https://github.com/phetsims/kite/issues/102 */ public getBoundsWithTransform( matrix: Matrix3 ): Bounds2 { const transformedSegment = this.transformed( matrix ); @@ -484,7 +484,7 @@ export default abstract class Segment { } public getClosestPoints( point: Vector2 ): ClosestToPointResult[] { - // TODO: solve segments to determine this analytically! (only implemented for Line right now, should be easy to do with some things) https://github.com/phetsims/tasks/issues/1129 + // TODO: solve segments to determine this analytically! (only implemented for Line right now, should be easy to do with some things) https://github.com/phetsims/kite/issues/102 return Segment.closestToPoint( [ this ], point, 1e-7 ); } @@ -492,7 +492,7 @@ export default abstract class Segment { * List of results (since there can be duplicates), threshold is used for subdivision, * where it will exit if all of the segments are shorter than the threshold * - * TODO: solve segments to determine this analytically! https://github.com/phetsims/tasks/issues/1129 + * TODO: solve segments to determine this analytically! https://github.com/phetsims/kite/issues/102 */ public static closestToPoint( segments: Segment[], point: Vector2, threshold: number ): ClosestToPointResult[] { type Item = { @@ -771,11 +771,11 @@ export default abstract class Segment { * Returns a Segment from the serialized representation. */ public static deserialize( obj: SerializedSegment ): Segment { - // TODO: just import them now that we have circular reference protection, and switch between https://github.com/phetsims/tasks/issues/1129 - // @ts-expect-error TODO: namespacing https://github.com/phetsims/tasks/issues/1129 + // TODO: just import them now that we have circular reference protection, and switch between https://github.com/phetsims/kite/issues/102 + // @ts-expect-error TODO: namespacing https://github.com/phetsims/kite/issues/102 assert && assert( obj.type && kite[ obj.type ] && kite[ obj.type ].deserialize ); - // @ts-expect-error TODO: namespacing https://github.com/phetsims/tasks/issues/1129 + // @ts-expect-error TODO: namespacing https://github.com/phetsims/kite/issues/102 return kite[ obj.type ].deserialize( obj ); } diff --git a/js/util/LineStyles.ts b/js/util/LineStyles.ts index c815ec4..3a076d4 100644 --- a/js/util/LineStyles.ts +++ b/js/util/LineStyles.ts @@ -192,7 +192,7 @@ export default class LineStyles { } else { // no join necessary here since we have the acute angle. just simple lineTo for now so that the next segment starts from the right place - // TODO: can we prevent self-intersection here? https://github.com/phetsims/tasks/issues/1129 + // TODO: can we prevent self-intersection here? https://github.com/phetsims/kite/issues/102 return bevel; } } diff --git a/js/util/Subpath.ts b/js/util/Subpath.ts index 7e4f688..2eb02f9 100644 --- a/js/util/Subpath.ts +++ b/js/util/Subpath.ts @@ -203,7 +203,7 @@ class Subpath { /** * Returns the numbers of points in this subpath * - * TODO: This is a confusing name! It should be getNumPoints() or something https://github.com/phetsims/tasks/issues/1129 + * TODO: This is a confusing name! It should be getNumPoints() or something https://github.com/phetsims/kite/issues/102 */ public getLength(): number { return this.points.length; @@ -370,7 +370,7 @@ class Subpath { /** * Returns a subpath that is offset from this subpath by a distance * - * TODO: Resolve the bug with the inside-line-join overlap. We have the intersection handling now (potentially) https://github.com/phetsims/tasks/issues/1129 + * TODO: Resolve the bug with the inside-line-join overlap. We have the intersection handling now (potentially) https://github.com/phetsims/kite/issues/102 */ public offset( distance: number ): Subpath { if ( !this.isDrawable() ) {