import {BaseSopOperation} from "./_Base";
import {TorusBufferGeometry as TorusBufferGeometry2} from "three/src/geometries/TorusBufferGeometry";
import {Vector3 as Vector32} from "three/src/math/Vector3";
import {InputCloneMode as InputCloneMode2} from "../../../engine/poly/InputCloneMode";
import {CoreTransform} from "../../Transform";
const DEFAULT_UP = new Vector32(0, 0, 1);
export class TorusSopOperation extends BaseSopOperation {
  constructor() {
    super(...arguments);
    this._core_transform = new CoreTransform();
  }
  static type() {
    return "torus";
  }
  cook(input_contents, params) {
    const radius = params.radius;
    const radiusTube = params.radiusTube;
    const segmentsRadial = params.segmentsRadial;
    const segmentsTube = params.segmentsTube;
    const geometry = new TorusBufferGeometry2(radius, radiusTube, segmentsRadial, segmentsTube);
    geometry.translate(params.center.x, params.center.y, params.center.z);
    this._core_transform.rotate_geometry(geometry, DEFAULT_UP, params.direction);
    return this.create_core_group_from_geometry(geometry);
  }
}
TorusSopOperation.DEFAULT_PARAMS = {
  radius: 1,
  radiusTube: 1,
  segmentsRadial: 20,
  segmentsTube: 12,
  direction: new Vector32(0, 1, 0),
  center: new Vector32(0, 0, 0)
};
TorusSopOperation.INPUT_CLONED_STATE = InputCloneMode2.FROM_NODE;
