지정된 두 정점을 중심으로 회전 API
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private System.Timers.Timer timerScrew;
private void Example()
{
timerScrew = new System.Timers.Timer();
timerScrew.Interval = 100;
timerScrew.Elapsed += TimerScrew_Elapsed;
AnimationScrew(true);
}
private List<VIZCore3D.NET.Data.Node> NODES_SCREW1 { get; set; }
private List<VIZCore3D.NET.Data.Node> NODES_SCREW2 { get; set; }
private float Screw_Rotate_Angle = 0;
private void AnimationScrew(bool enable)
{
if (enable == true)
{
NODES_SCREW1 = vizcore3d.Object3D.Find.QuickSearch("SHIP_SCREW#1", true);
NODES_SCREW2 = vizcore3d.Object3D.Find.QuickSearch("SHIP_SCREW#2", true);
timerScrew.Enabled = true;
}
else
{
timerScrew.Enabled = false;
}
}
private void TimerScrew_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
timerScrew.Enabled = false;
this.Invoke(new EventHandler(delegate
{
RotateScrew();
}));
timerScrew.Enabled = true;
}
private void RotateScrew()
{
vizcore3d.BeginUpdate();
vizcore3d.Object3D.Transform.Rotate(
NODES_SCREW1
, new VIZCore3D.NET.Data.Vertex3D(-40144.21, 2159.66, -15277.70)
, new VIZCore3D.NET.Data.Vertex3D(-38685.59, 2170.91, -15204.43)
, Screw_Rotate_Angle % 360
, VIZCore3D.NET.Data.AngleFormat.DEGREE
);
vizcore3d.Object3D.Transform.Rotate(
NODES_SCREW2
, new VIZCore3D.NET.Data.Vertex3D(-40110.58, -2575.70, -15209.66)
, new VIZCore3D.NET.Data.Vertex3D(-38651.92, -2564.30, -15135.98)
, Screw_Rotate_Angle % 360
, VIZCore3D.NET.Data.AngleFormat.DEGREE
);
Screw_Rotate_Angle += 30;
vizcore3d.EndUpdate();
}
Body 노드의 형상(Triangle Mesh)을 추가/수정 API
// VIZCore3D.NET Control
private VIZCore3D.NET.VIZCore3DControl vizcore3d;
private void Example()
{
List<int> bodies = new List<int>();
List<int> coordListNum = new List<int>();
List<VIZCore3D.NET.Data.Vertex3D> v = new List<VIZCore3D.NET.Data.Vertex3D>();
List<VIZCore3D.NET.Data.Vector3D> n = new List<VIZCore3D.NET.Data.Vector3D>();
List<float> color = new List<float>();
// 면 #1
bodies.Add(2296); // Body Index
coordListNum.Add(18); // Vertex Float 총 개수
// Vertex 좌표 => Triangle Mesh 를 기반
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 10600.00, 35572.12));
v.Add(new VIZCore3D.NET.Data.Vertex3D(71890.00, 10600.00, 35572.12));
v.Add(new VIZCore3D.NET.Data.Vertex3D(72324.89, 7170.00, 35645.86));
v.Add(new VIZCore3D.NET.Data.Vertex3D(72324.89, 7170.00, 35645.86));
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 7170.00, 35645.86));
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 10600.00, 35572.12));
// Normal 좌표
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
// 면의 색상 설정
color.Add(1.000f); // R
color.Add(1.000f); // G
color.Add(0.000f); // B
color.Add(1); // A
// 면 #2
bodies.Add(2293); // Body Index
coordListNum.Add(18); // Vertex Float 총 개수
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 7170.00, 35645.86));
v.Add(new VIZCore3D.NET.Data.Vertex3D(72324.89, 7170.00, 35645.86));
v.Add(new VIZCore3D.NET.Data.Vertex3D(71890.00, 3740.00, 35719.60));
v.Add(new VIZCore3D.NET.Data.Vertex3D(71890.00, 3740.00, 35719.60));
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 3740.00, 35719.60));
v.Add(new VIZCore3D.NET.Data.Vertex3D(80180.00, 7170.00, 35645.86));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
n.Add(new VIZCore3D.NET.Data.Vector3D(0.00, 0.00, -1.00));
color.Add(0.043f); // R
color.Add(0.043f); // G
color.Add(0.043f); // B
color.Add(1); // A
vizcore3d.MeshEdit.ChangeBodyMesh(
bodies /* BODY INDEX LIST */
, v /* VERTEX LIST */
, n /* NORMAL LIST */
, color /* COLOR */
, coordListNum /* VERTEX COUNT LIST */
);
}