예제 #1
0
 public static dynamic GetTSObject(Polymesh dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
예제 #2
0
        private void BtnValidateCube_Click(object sender, EventArgs e)
        {
            var cubeBRep = CreateBrepCube(500.0);

            var invalidInfo = new List <KeyValuePair <int, Polymesh.PolymeshHealthCheckEnum> >();
            var result      = Polymesh.Validate(cubeBRep, Polymesh.PolymeshCheckerFlags.All, ref invalidInfo);

            if (result)
            {
                validateResult.Text = "The cube has valid geometry";
            }
            else
            {
                validateResult.Text = "The cube has invalid geometry";
            }
        }
예제 #3
0
파일: Tile.cs 프로젝트: DDHustle/TheGame
        /// <summary>
        ///
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Pos"></param>
        /// <param name="Rad"></param>
        /// <returns></returns>
        public Polymesh GetBaseMesh(int X, int Y, Vector2f Pos, float Rad)
        {
            if (!IsWall)
            {
                return(null);
            }

            Polymesh SShape = new Polymesh(new Vector2f[] {
                new Vector2f(0, 0),
                new Vector2f(TileMgr.TileSize, 0),
                new Vector2f(TileMgr.TileSize, TileMgr.TileSize),
                new Vector2f(TileMgr.TileSize, TileMgr.TileSize),
                new Vector2f(0, TileMgr.TileSize),
                new Vector2f(0, 0),
            }, Color.White);

            return(SShape.Add(new Vector2f(X * TileMgr.TileSize, Y * TileMgr.TileSize)));
        }
예제 #4
0
        public Polymesh[] GetShadowMesh(Vector2f Pos, float Rad)
        {
            // TODO: Clip properly
            List <Polymesh> Shapes = new List <Polymesh>();

            for (int x = 0; x < W; x++)
            {
                for (int y = 0; y < H; y++)
                {
                    Polymesh S = Tiles[x, y].GetShadowMesh(x, y, Pos, Rad);
                    if (S != null)
                    {
                        Shapes.Add(S);
                    }
                }
            }

            return(Shapes.ToArray());
        }
예제 #5
0
파일: Tile.cs 프로젝트: DDHustle/TheGame
        /// <summary>
        ///
        /// </summary>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="Pos"></param>
        /// <param name="Rad"></param>
        /// <returns></returns>
        public Polymesh GetShadowMesh(int X, int Y, Vector2f Pos, float Rad)
        {
            if (!IsWall)
            {
                return(null);
            }

            Polymesh SShape = GetBaseMesh(X, Y, Pos, Rad);

            SShape.PolyColor = Color.Black;

            Vector2f[] Pts2 = new Vector2f[SShape.Length];
            for (int i = 0; i < Pts2.Length; i++)
            {
                float Ang = SShape[i].Angle(Pos);
                Pts2[i] = new Vector2f(SShape[i].X + Rad * (float)Math.Cos(Ang), SShape[i].Y + Rad * (float)Math.Sin(Ang));
            }

            return(SShape.Merge(Pts2));
        }