This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { | |
Routes, | |
RouterModule | |
} from '@angular/router'; | |
import { CalculatorComponent } from './features/quaternion-calculator/calculator/calculator.component'; | |
import { LoginComponent } from './features/login-page/login/login.component'; | |
const calculatorRoutes: Routes = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Main App module for the quaternion application (currently at Part I) | |
* | |
* @author Jim Armstrong | |
* | |
* @version 1.0 | |
*/ | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Model a section of the quaternion calculator store that pertains to all basic calculator actions | |
* | |
* @author Jim Armstrong (www.algorithmist.net) | |
* | |
* @version 1.0 | |
*/ | |
import { Q } from './Q'; | |
export class QCalc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Manage quaternion data | |
* | |
* @author Jim Armstrong | |
* | |
* @version 1.0 | |
*/ | |
export class Q | |
{ | |
public id = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public next(): void | |
{ | |
let circ: TSMT$Circle; | |
let g: PIXI.Graphics; | |
// first, redraw any circles previously marked as containing the point with the default stroke color | |
while (this._identifiedDO.length > 0) | |
{ | |
g = this._identifiedDO.pop(); | |
circ = this._identified.pop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected __initCircles(): void | |
{ | |
// Draw the point | |
this.__drawPoint(); | |
// Draw the circles at pseudo-random locations around the drawing area | |
const xHigh: number = (this._width - CircleService.MAX_RADIUS) + 0.499; | |
const yHigh: number = (this._height - CircleService.MAX_RADIUS) + 0.499; | |
let i: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async __loadComponent(): Promise<any> | |
{ | |
let factory: ComponentFactory<IPointInCircle>; | |
if (this.picContainer) { | |
this.picContainer.clear(); | |
} | |
// lazy-load the required component based on the algorithm id | |
switch (this.algorithm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await this.__loadComponent(); | |
if (this.ComponentInstance) | |
{ | |
// on every intersection | |
this.ComponentInstance.instance.intersect$.subscribe( (id: string) => this.__updateIntersection(id) ); | |
// begin simulation | |
timer(100, this._delta) | |
.pipe( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
. | |
. | |
this._expirationMonth = new FormControl(months[this._curMonth].value, Validators.required); | |
this._expirationYear = new FormControl(this._userSelectedYear, Validators.required); | |
this._cvv = new FormControl('', Validators.required); | |
this._expirationMonth.disable(); | |
this._expirationYear.disable(); | |
this._cvv.disable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
AbstractControl, | |
FormGroup, | |
ValidationErrors, | |
ValidatorFn, | |
} from '@angular/forms'; | |
import { isCCLengthValid } from '../libs/is-length-valid'; | |
import { getCardType } from '../libs/get-card-type'; | |
import { isValidLuhn } from '../libs/is-valid-luhn'; |