Skip to content

Commit

Permalink
expose in the doc the api of coo class
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatthieu3 committed Sep 11, 2024
1 parent 3c23b6d commit 8ee1614
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [feat] Add support for name removing in `removeOverlay` method
* [test] Add support of playwright. Instructions in the readme for running the test matching snapshots [PR #176]
* [fixed] Order of overlays in the stack now matches the addMOC/addCatalog/addOverlay calls ordering
* [doc] Expose the API of Coo class

## 3.5.0-beta

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"test:build": "cd src/core && cargo test --release --features webgl2",
"test:playwright": "npx playwright test",
"test:update-snapshots": "npx playwright test --update-snapshots",
"doc": "jsdoc -c jsdoc.json src/js src/js/shapes && cp aladin-logo.png docs/",
"doc": "jsdoc -c jsdoc.json src/js src/js/shapes src/js/libs/astro && cp aladin-logo.png docs/",
"doc:dev": "npm run doc && open docs/index.html"
},
"devDependencies": {
Expand Down
35 changes: 13 additions & 22 deletions src/js/libs/astro/coo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
import { AstroMath } from "./astroMath.js";

/**
* Constructor
* @param longitude longitude (decimal degrees)
* @param latitude latitude (decimal degrees)
* @param prec precision
* Represents a Coo with configurable parsing options.
*
* @class
* @constructs Coo
*
* @param {number} longitude longitude (decimal degrees)
* @param {number} latitude latitude (decimal degrees)
* @param {number} prec precision
* (8: 1/1000th sec, 7: 1/100th sec, 6: 1/10th sec, 5: sec, 4: 1/10th min, 3: min, 2: 1/10th deg, 1: deg
*/
export let Coo = function(longitude, latitude, prec) {
Expand Down Expand Up @@ -52,7 +56,7 @@ Coo.prototype = {

/**
* Squared distance between 2 points (= 4.sin<sup>2</sup>(r/2))
* @param pos another position on the sphere
* @param {Coo} pos another position on the sphere
* @return ||pos-this||<sup>2</sup> = 4.sin<sup>2</sup>(r/2)
**/
dist2: function(pos) {
Expand All @@ -67,7 +71,7 @@ Coo.prototype = {

/**
* Distance between 2 points on the sphere.
* @param pos another position on the sphere
* @param {Coo} pos another position on the sphere
* @return distance in degrees in range [0, 180]
**/
distance: function(pos) {
Expand All @@ -77,10 +81,6 @@ Coo.prototype = {
return (2. * AstroMath.asind(0.5 * Math.sqrt(this.dist2(pos))));
},

/**
* Transform the position into another frame.
* @param new_frame The frame of the resulting position.
**/
convertTo: function(new_frame) {
// Verify first if frames identical -- then nothing to do !
if (this.frame.equals(new_frame)) {
Expand All @@ -94,10 +94,6 @@ Coo.prototype = {
this.lon = this.lat = 0./0.; // Actual angles not recomputed
},

/**
* Rotate a coordinate (apply a rotation to the position).
* @param R [3][3] Rotation Matrix
*/
rotate: function(R) {
var X, Y, Z;
if (R == Umatrix3) return;
Expand All @@ -109,11 +105,6 @@ Coo.prototype = {
this.lon = this.lat = 0./0.;
},

/**
* Rotate a coordinate (apply a rotation to the position) in reverse direction.
* The method is the inverse of rotate.
* @param R [3][3] Rotation Matrix
*/
rotate_1: function(R) {
var X, Y, Z;
if (R == Umatrix3) return;
Expand All @@ -128,7 +119,7 @@ Coo.prototype = {

/**
* Test equality of Coo.
* @param coo Second coordinate to compare with
* @param {Coo} coo Second coordinate to compare with
* @return True if the two coordinates are equal
*/
equals: function(coo) {
Expand All @@ -137,7 +128,7 @@ Coo.prototype = {

/**
* parse a coordinate string. The coordinates can be in decimal or sexagesimal
* @param str string to parse
* @param {string} str string to parse
* @return true if the parsing succeded, false otherwise
*/
parse: function(str) {
Expand Down Expand Up @@ -234,7 +225,7 @@ Coo.prototype = {

/**
* Format coordinates according to the options
* @param options 'd': decimal, 's': sexagésimal, '/': space separated, '2': return [ra,dec] in an array
* @param {string} options 'd': decimal, 's': sexagésimal, '/': space separated, '2': return [ra,dec] in an array
* @return the formatted coordinates
*/
format: function(options) {
Expand Down

0 comments on commit 8ee1614

Please sign in to comment.