static void Main(string[] args) { msgCore.InitKernel(); msg3DObject.AutoTriangulate(true, msgTriangulationTypeEnum.SG_DELAUNAY_TRIANGULATION); msgCircleStruct circleStruct = new msgCircleStruct(); msgPointStruct p1 = new msgPointStruct(); p1.x = 0; p1.y = 0; p1.z = 0; msgPointStruct p2 = new msgPointStruct(); p2.x = 1; p2.y = 1; p2.z = 1; msgPointStruct p3 = new msgPointStruct(); p3.x = 0; p3.y = 0; p3.z = 1; circleStruct.FromThreePoints(p1, p2, p3); msgCircle circle = msgCircle.Create(circleStruct); msgCore.FreeKernel(); }
public static void CreateLinear() { msgScene scene = msgScene.GetScene(); scene.Clear(); Utils.AddFloorInScene(30.0, 30.0, 2.0, 5.0, -2.0); msgPointStruct tmpPnt = new msgPointStruct(); msgSplineStruct spl1 = msgSplineStruct.Create(); int fl = 0; for (double i = 0.0; i < 2.0 * 3.14159265; i += 0.4) { tmpPnt.x = ((double)(fl % 3 + 2)) * Math.Cos(i); tmpPnt.y = ((double)(fl % 3 + 2)) * Math.Sin(i); tmpPnt.z = 0.0; spl1.AddKnot(tmpPnt, fl); fl++; } spl1.Close(); msgSpline spl1_obj = msgSpline.Create(spl1); scene.AttachObject(spl1_obj); spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12); spl1_obj.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2); msgSplineStruct.Delete(spl1); msgCircleStruct cirGeo = new msgCircleStruct(); cirGeo.center.x = 2.0; cirGeo.center.y = -2.0; cirGeo.center.z = 8.0; cirGeo.normal.x = 0.0; cirGeo.normal.y = 0.0; cirGeo.normal.z = 1.0; cirGeo.radius = 1.5; msgCircle cir = msgCircle.Create(cirGeo); scene.AttachObject(cir); cir.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 12); cir.SetAttribute(msgObjectAttrEnum.SG_OA_LINE_THICKNESS, 2); msg3DObject linO1 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj, cir, 0.5f, false); scene.AttachObject(linO1); linO1.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 90); msgVectorStruct transV1 = new msgVectorStruct(0, 7, 0); linO1.InitTempMatrix().Translate(transV1); linO1.ApplyTempMatrix(); linO1.DestroyTempMatrix(); msg3DObject linO2 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj, cir, 0.7f, true); scene.AttachObject(linO2); linO2.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 150); transV1.x = 8.0; transV1.y = 0.0; linO2.InitTempMatrix().Translate(transV1); linO2.ApplyTempMatrix(); linO2.DestroyTempMatrix(); msg3DObject linO3 = (msg3DObject)msgSurfaces.LinearSurfaceFromSections(spl1_obj, cir, 0.3f, false); scene.AttachObject(linO3); linO3.SetAttribute(msgObjectAttrEnum.SG_OA_COLOR, 30); transV1.x = -8.0; transV1.y = 0.0; linO3.InitTempMatrix().Translate(transV1); linO3.ApplyTempMatrix(); linO3.DestroyTempMatrix(); }