openchemlib 9.22.1 → 9.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -246,6 +246,17 @@ export interface Rectangle {
246
246
  height: number;
247
247
  }
248
248
 
249
+ export interface Coordinates {
250
+ /** X-coordinate. */
251
+ x: number;
252
+
253
+ /** Y-coordinate. */
254
+ y: number;
255
+
256
+ /** Z-coordinate. */
257
+ z: number;
258
+ }
259
+
249
260
  export declare class Molecule {
250
261
  /**
251
262
  * Construct a new molecule.
@@ -1804,6 +1815,33 @@ export declare class Molecule {
1804
1815
 
1805
1816
  scaleCoords(f: number): void;
1806
1817
 
1818
+ /**
1819
+ * Returns a copy of the atom's 3D coordinates. Mutating it does not change the
1820
+ * molecule; use `setCoordinates` (or `setAtomX`/`setAtomY`/`setAtomZ`) to
1821
+ * write the values back.
1822
+ */
1823
+ getCoordinates(atom: number): Coordinates;
1824
+
1825
+ setCoordinates(atom: number, coordinates: Coordinates): void;
1826
+
1827
+ /**
1828
+ * 3D translation of every atom by a `{ x, y, z }` vector (`translateCoords` is
1829
+ * 2D and ignores z).
1830
+ */
1831
+ translate(coordinates: Coordinates): void;
1832
+
1833
+ /**
1834
+ * Rotates every atom in 3D by a 3x3 matrix. OpenChemLib uses the row-vector
1835
+ * convention: `x' = x*m[0][0] + y*m[1][0] + z*m[2][0]` (and likewise for y, z).
1836
+ */
1837
+ rotate(matrix: number[][]): void;
1838
+
1839
+ /** Translate the molecule so its center of gravity is at the origin. */
1840
+ center(): void;
1841
+
1842
+ /** Center of gravity (all atoms with equal weight); `{ x: 0, y: 0, z: 0 }` if there are no atoms. */
1843
+ getCenterOfGravity(): Coordinates;
1844
+
1807
1845
  zoomAndRotateInit(x: number, y: number): void;
1808
1846
 
1809
1847
  zoomAndRotate(zoom: number, angle: number, selected: boolean): void;