Home Manual Reference Source

src/basic/S3Vertex.js

  1. import S3Vector from "../math/S3Vector.js";
  2.  
  3. /**
  4. * 3DCG用の頂点クラス(immutable)
  5. * 各頂点の空間上の座標情報を管理するシンプルなクラスです。
  6. *
  7. * @class
  8. * @module S3
  9. */
  10. export default class S3Vertex {
  11. /**
  12. * 頂点を作成します。(immutable)
  13. * @param {S3Vector} position 頂点の座標ベクトル
  14. */
  15. constructor(position) {
  16. /**
  17. * 頂点の座標ベクトル
  18. * @type {S3Vector}
  19. */
  20. this.position = position;
  21. }
  22.  
  23. /**
  24. * 頂点インスタンスのクローン(複製)を作成します。
  25. * @param {typeof S3Vertex} [Instance] 複製する際のクラス指定(省略時はS3Vertex)
  26. * @returns {S3Vertex} 複製されたS3Vertexインスタンス
  27. */
  28. clone(Instance) {
  29. if (!Instance) {
  30. Instance = S3Vertex;
  31. }
  32. return new Instance(this.position);
  33. }
  34. }