EditRotate

객체 회전을 위한 기능 클래스.
A functionality class for object rotation.
※ 주의사항(Note).
일반 Entity 객체에서는 기능이 제한됩니다.
Functionality is limited on regular Entity objects..

new Ditap.EditRotate()

Example:
const viewer = new Ditap.DitapViewer("ditapContainer");

const destination = Ditap.Cartesian3.fromDegrees(
  126.978275264,
  37.566642192,
  400
);

// 카메라 이동
viewer.scene.camera.flyTo({
  destination: destination,
});

const position = Ditap.Cartesian3.fromDegrees(126.9782349646649, 37.56671536989183, 100);
const modelMatrix = Ditap.Transforms.eastNorthUpToFixedFrame(position);
const model = await Ditap.Model.fromGltfAsync{
 id: "model_01",
 url: "../../SampleData/models/GroundVehicle/GroundVehicle.glb",
 modelMatrix: modelMatrix,
 scale: 3,
});
viewer.scene.primitives.add(model);

const entity = new Ditap.DitapEntity({
 position: position,
 cylinder: {
   length: 40.0,
   topRadius: 0.0,
   bottomRadius: 20.0,
   material: Color.RED,
 }
});
viewer.entities.add(entity);

// 1-1. 입력된 Heading, Pitch, Roll 값으로 회전
const setHPR = new Ditap.HeadingPitchRoll(0, 0, 1.8);
EditRotate.setRotation(model, setHPR);
// 1-2. 입력된 Heading, Pitch, Roll 값 만큼 회전
const addHPR = new Ditap.HeadingPitchRoll(0, 0, 1.8);
EditRotate.addRotation(model, addHPR);
// 1-3. 입력된 Quaternion 값 으로 회전
const setQTN = new Ditap.Quaternion(0, 0, 1.8, 1);
EditRotate.setRotation(model, setQTN);
// 1-4. 입력된 Quaternion 값 만큼 회전
const addQTN = new Ditap.Quaternion(0, 0, 1.8, 1);
EditRotate.addRotation(model, addQTN);
// 1-5. Entity, DitapEntity, PointEntity, LinestringEntity, PolygonEntity 입력된 값으로 회전
const setEetityOrientation = Ditap.Transforms.headingPitchRollQuaternion(
 position,
 new Ditap.HeadingPitchRoll(0, 1.57, 0)
);
EditRotate.setRotation(entity, setEetityOrientation);
// 1-6. Entity, DitapEntity, PointEntity, LinestringEntity, PolygonEntity 입력된 값 만큼 회전.
EditRotate.addRotate(entity, new HeadingPitchRoll(0, 1.57, 0));

// 2. 마우스로 객체 회전
const interactionRotate = new Ditap.InteractionRotate(viewer);
interactionRotate.on();

Methods

static Ditap.EditRotate.addRotation(object, rotation)HeadingPitchRoll|Quaternion

헤딩, 피치, 롤 추가.
Add headingPitchRoll.
Name Type Description
object Model | Cesium3DTileset | Entity | PointEntity | LinestringEntity | PolygonEntity 헤딩, 피치, 롤 추가할 모델.
The model to which to add the heading, pitch, and roll.
rotation HeadingPitchRoll | Quaternion 회전값.
Rotation value.
Returns:
적용된 회전.
Applied rotation.
Example:
const viewer = new Ditap.DitapViewer("ditapContainer");

const destination = Ditap.Cartesian3.fromDegrees(
  126.978275264,
  37.566642192,
  400
);

// 카메라 이동
viewer.scene.camera.flyTo({
  destination: destination,
});

const modelMatrix = Ditap.Transforms.eastNorthUpToFixedFrame(
  Ditap.Cartesian3.fromDegrees(126.9782349646649, 37.56671536989183, 100)
);
const model = await Ditap.Model.fromGltfAsync{
 id: "model_01",
 url: "../../SampleData/models/GroundVehicle/GroundVehicle.glb",
 modelMatrix: modelMatrix,
 scale: 3,
});
viewer.scene.primitives.add(model);

const entity = new Ditap.DitapEntity({
 position: position,
 cylinder: {
   length: 40.0,
   topRadius: 0.0,
   bottomRadius: 20.0,
   material: Color.RED,
 }
});
viewer.entities.add(entity);

EditRotate.addRotation(model, new Ditap.HeadingPitchRoll(10, 0, 0));

static Ditap.EditRotate.decomposite(object, enu)Object

객체의 트랜스폼 추출.
Extracting object's transform
Name Type Default Description
object Model | Cesium3DTileset | Entity | PointEntity | LinestringEntity | PolygonEntity 트랜스폼을 구할 객체.
Object to obtain transform.
enu boolean true optional East-North-Up 기준 추출.
East-North-Up criteria extraction.
Returns:
트랜스폼 정보.
Transform info.

static Ditap.EditRotate.getHeadingPitchRoll(object, enu)HeadingPitchRoll

객체의 헤딩-피치-롤.
Heading-Pitch-Roll of the object.
Name Type Default Description
object Model | Cesium3DTileset | Entity | PointEntity | LinestringEntity | PolygonEntity 헤딩-피치-롤을 구할 객체.
Object to calculate Heading-Pitch-Roll.
enu boolean true optional East-North-Up 기준 회전값.
Rotation value with respect to East-North-Up.
Returns:
헤딩-피치-롤.
Heading-Pitch-Roll.

static Ditap.EditRotate.getQuaternion(object, enu)Quaternion

객체의 쿼터니언.
Quaternion of the object.
Name Type Default Description
object Model | Cesium3DTileset | Entity | PointEntity | LinestringEntity | PolygonEntity 쿼터니언을 구할 객체.
Object to calculate quaternion.
enu boolean true optional East-North-Up 기준 회전값.
Rotation value with respect to East-North-Up.
Returns:
쿼터니언.
Quaternion.

static Ditap.EditRotate.setRotation(object, rotation)HeadingPitchRoll|Quaternion|Property

모델의 헤딩, 피치, 롤 설정.
Set HeadingPitchRoll.
Name Type Description
object Model | Cesium3DTileset | Entity | PointEntity | LinestringEntity | PolygonEntity 헤딩, 피치, 롤 적용할 모델.
The model to which to apply the heading, pitch, and roll.
rotation HeadingPitchRoll | Quaternion | Property 회전값.
Rotation value.
Returns:
적용된 회전.
Applied rotation.
Example:
const viewer = new Ditap.DitapViewer("ditapContainer");

const destination = Ditap.Cartesian3.fromDegrees(
  126.978275264,
  37.566642192,
  400
);

// 카메라 이동
viewer.scene.camera.flyTo({
  destination: destination,
});

const modelMatrix = Ditap.Transforms.eastNorthUpToFixedFrame(
  Ditap.Cartesian3.fromDegrees(126.9782349646649, 37.56671536989183, 100)
);
const model = await Ditap.Model.fromGltfAsync{
 id: "model_01",
 url: "../../SampleData/models/GroundVehicle/GroundVehicle.glb",
 modelMatrix: modelMatrix,
 scale: 3,
});
viewer.scene.primitives.add(model);

const entity = new Ditap.DitapEntity({
 position: position,
 cylinder: {
   length: 40.0,
   topRadius: 0.0,
   bottomRadius: 20.0,
   material: Color.RED,
 }
});
viewer.entities.add(entity);

// Model
EditRotate.setRotation(model, new HeadingPitchRoll(10, 0, 0));

// Entity
const setEetityOrientation = Ditap.Transforms.headingPitchRollQuaternion(
 position,
 new Ditap.HeadingPitchRoll(0, 1.57, 0)
);
EditRotate.setRotation(entity, setEetityOrientation);