virtual protected DMesh3 make_shape_arrow() { float radius = (float)ShapeWidth / 2; float total_height = (float)ShapeHeight; float head_height = total_height * (0.4f); float stick_height = total_height * (0.6f); float tip_radius = radius * 0.01f; float stick_radius = radius * 0.5f; Vector3d origin = new Vector3d(0, ShapeHeight / 2, 0); Radial3DArrowGenerator arrowgen = new Radial3DArrowGenerator() { HeadBaseRadius = radius, TipRadius = tip_radius, HeadLength = head_height, StickRadius = stick_radius, StickLength = stick_height, Slices = Math.Max(2, Subdivisions), NoSharedVertices = false, Clockwise = true }; DMesh3 mesh = arrowgen.Generate().MakeDMesh();; // fuuuuck MeshAutoRepair repair = new MeshAutoRepair(mesh); repair.Apply(); return(mesh); }
public override fMesh MakeGeometry(AxisGizmoFlags widget) { switch (widget) { case AxisGizmoFlags.AxisTranslateY: if (MyAxisTranslateY == null) { Radial3DArrowGenerator arrowGen = new Radial3DArrowGenerator() { HeadLength = 2.0f, TipRadius = 0.1f, StickLength = 1.5f, Clockwise = true }; DMesh3 mesh = arrowGen.Generate().MakeDMesh(); MeshNormals.QuickCompute(mesh); MeshTransforms.Translate(mesh, 0.5 * Vector3d.AxisY); DMesh3 flip = new DMesh3(mesh); MeshTransforms.Rotate(flip, Vector3d.Zero, Quaterniond.AxisAngleD(Vector3d.AxisX, 180)); MeshEditor.Append(mesh, flip); MyAxisTranslateY = new fMesh(mesh); } return(MyAxisTranslateY); default: return(null); } }
public static Mesh Create3DArrow(float HeadLength, float HeadWidth, float StickLength, float StickWidth, int nSlices) { Radial3DArrowGenerator gen = new Radial3DArrowGenerator() { Clockwise = true, Slices = nSlices, HeadLength = HeadLength, HeadBaseRadius = HeadWidth*0.5f, StickLength = StickLength, StickRadius = StickWidth*0.5f }; gen.Generate(); return gen.MakeUnityMesh(true); }
public static Mesh Create3DArrow(float Length, float Width, int nSlices) { Radial3DArrowGenerator gen = new Radial3DArrowGenerator() { Clockwise = true, Slices = nSlices }; gen.HeadLength = Length / 3.0f; gen.HeadBaseRadius = Width * 0.5f; gen.StickLength = Length - gen.HeadLength; gen.StickRadius = 0.5f * gen.HeadBaseRadius; gen.Generate(); return gen.MakeUnityMesh(true); }