Skip to content

Commit

Permalink
Use Vector2.get angle instead of .angle(), see phetsims/dot#84
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Feb 15, 2019
1 parent c8fbe28 commit 95fe806
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion js/common/model/EnergyChunkWanderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ define( require => {
*/
changeVelocityVector() {
const vectorToDestination = this.destinationProperty.value.minus( this.energyChunk.positionProperty.value );
let angle = vectorToDestination.angle();
let angle = vectorToDestination.angle;
if ( vectorToDestination.magnitude() > DISTANCE_AT_WHICH_TO_STOP_WANDERING && this.wandering ) {

// add some randomness to the direction of travel
Expand Down
8 changes: 4 additions & 4 deletions js/systems/model/Belt.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ define( require => {
beltShape.arcPoint(
wheel1Center,
wheel1Radius,
wheel1CenterToArcStart.angle(),
wheel1CenterToArcEnd.angle(),
wheel1CenterToArcStart.angle,
wheel1CenterToArcEnd.angle,
false
);
beltShape.lineToPoint( wheel2Center.plus( wheel2CenterToArcStart ) );
beltShape.arcPoint(
wheel2Center,
wheel2Radius,
wheel2CenterToArcStart.angle(),
wheel2CenterToArcEnd.angle()
wheel2CenterToArcStart.angle,
wheel2CenterToArcEnd.angle
);
beltShape.lineToPoint( wheel1Center.plus( wheel1CenterToArcStart ) );
beltShape.close();
Expand Down
2 changes: 1 addition & 1 deletion js/systems/model/EnergyChunkPathMover.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ define( require => {
if ( distanceToTravel < distanceToNextPoint ) {

// the energy chunk will not reach the next destination point during this step, so just move that direction
const phi = this.nextPoint.minus( this.energyChunk.positionProperty.get() ).angle();
const phi = this.nextPoint.minus( this.energyChunk.positionProperty.get() ).angle;
const velocity = new Vector2( distanceToTravel, 0 ).rotated( phi );
this.energyChunk.positionProperty.set( this.energyChunk.positionProperty.get().plus( velocity ) );
distanceToTravel = 0; // no remaining distance
Expand Down
2 changes: 1 addition & 1 deletion js/systems/model/SolarPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ define( require => {
const absorptionBounds = this.getAbsorptionShape().bounds;
const lowerLeftOfPanel = new Vector2( absorptionBounds.minX, absorptionBounds.minY );
const upperRightOfPanel = new Vector2( absorptionBounds.maxX, absorptionBounds.maxY );
const crossLineAngle = upperRightOfPanel.minus( lowerLeftOfPanel ).angle();
const crossLineAngle = upperRightOfPanel.minus( lowerLeftOfPanel ).angle;
const crossLineLength = lowerLeftOfPanel.distance( upperRightOfPanel );
const dt = 1 / EFACConstants.FRAMES_PER_SECOND;
let energySinceLastChunk = EFACConstants.ENERGY_PER_CHUNK * 0.99;
Expand Down
6 changes: 3 additions & 3 deletions js/systems/model/SunEnergySource.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ define( require => {

const inClouds = cloud.getCloudAbsorptionReflectionShape().containsPoint( chunk.positionProperty.value );
const inList = _.includes( this.energyChunksPassingThroughClouds, chunk );
const deltaPhi = chunk.velocity.angle() - chunk.positionProperty.value.minus( this.sunPosition ).angle();
const deltaPhi = chunk.velocity.angle - chunk.positionProperty.value.minus( this.sunPosition ).angle;

if ( inClouds && !inList && Math.abs( deltaPhi ) < Math.PI / 10 ) {

Expand All @@ -171,8 +171,8 @@ define( require => {

// Reflect the energy chunk. It looks a little weird if they go back to the sun, so the code below
// tries to avoid that.
const angleTowardsSun = chunk.velocity.angle() + Math.PI;
const reflectionAngle = chunk.positionProperty.value.minus( cloud.getCenterPosition() ).angle();
const angleTowardsSun = chunk.velocity.angle + Math.PI;
const reflectionAngle = chunk.positionProperty.value.minus( cloud.getCenterPosition() ).angle;

if ( reflectionAngle < angleTowardsSun ) {
chunk.setVelocity( chunk.velocity.rotated(
Expand Down
4 changes: 2 additions & 2 deletions js/systems/view/LightRayNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ define( require => {
// Search linearly for edge of the shape. BIG HAIRY NOTE - This will not work in all cases. It worked for the
// coarse shapes and rough bounds needed for this simulation. Don't reuse if you need good general edge
// finding.
const angle = endpoint.minus( origin ).angle();
const angle = endpoint.minus( origin ).angle;
const incrementalDistance = boundsEntryPoint.distance( searchEndPoint ) / SEARCH_ITERATIONS;
for ( let i = 0; i < SEARCH_ITERATIONS; i++ ) {
const testPoint = boundsEntryPoint.plus( new Vector2( incrementalDistance * i, 0 ).rotated( angle ) );
Expand Down Expand Up @@ -233,7 +233,7 @@ define( require => {
if ( !shape.bounds.containsPoint( endpoint ) && shape.interiorIntersectsLineSegment( origin, endpoint ) ) {

// phase I - Do a binary search to locate the edge of the rectangle that encloses the shape
const angle = endpoint.minus( origin ).angle();
const angle = endpoint.minus( origin ).angle;
let length = origin.distance( endpoint );
let lengthChange = length / 2;
for ( let i = 0; i < SEARCH_ITERATIONS; i++ ) {
Expand Down

0 comments on commit 95fe806

Please sign in to comment.