• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Face类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Face的典型用法代码示例。如果您正苦于以下问题:C# Face类的具体用法?C# Face怎么用?C# Face使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Face类属于命名空间,在下文中一共展示了Face类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Align

		public Align(CsgObject objectToAlign, Face boundingFacesToAlign, Vector3 positionToAlignTo, string name = "")
			: base(objectToAlign, positionToAlignTo, name)
		{
			AxisAlignedBoundingBox bounds = objectToAlign.GetAxisAlignedBoundingBox();

			if (IsSet(boundingFacesToAlign, Face.Left, Face.Right))
			{
				positionToAlignTo.x = positionToAlignTo.x - bounds.minXYZ.x;
			}
			if (IsSet(boundingFacesToAlign, Face.Right, Face.Left))
			{
				positionToAlignTo.x = positionToAlignTo.x - bounds.minXYZ.x - (bounds.maxXYZ.x - bounds.minXYZ.x);
			}
			if (IsSet(boundingFacesToAlign, Face.Front, Face.Back))
			{
				positionToAlignTo.y = positionToAlignTo.y - bounds.minXYZ.y;
			}
			if (IsSet(boundingFacesToAlign, Face.Back, Face.Front))
			{
				positionToAlignTo.y = positionToAlignTo.y - bounds.minXYZ.y - (bounds.maxXYZ.y - bounds.minXYZ.y);
			}
			if (IsSet(boundingFacesToAlign, Face.Bottom, Face.Top))
			{
				positionToAlignTo.z = positionToAlignTo.z - bounds.minXYZ.z;
			}
			if (IsSet(boundingFacesToAlign, Face.Top, Face.Bottom))
			{
				positionToAlignTo.z = positionToAlignTo.z - bounds.minXYZ.z - (bounds.maxXYZ.z - bounds.minXYZ.z);
			}

			base.Translation = positionToAlignTo;
		}
开发者ID:glocklueng,项目名称:agg-sharp,代码行数:32,代码来源:Align.cs


示例2: Parse

 protected override void Parse(EndianBinaryReader r)
 {
     EID = ReadVarInt(r);
     Title = ReadString8(r);
     Position = CoordInt.Read(r);
     FaceDirection = (Face)r.ReadByte();
 }
开发者ID:mctraveler,项目名称:MineSharp,代码行数:7,代码来源:SpawnPainting.cs


示例3: RunConsciousRoutine

        protected override RoutineResult RunConsciousRoutine()
        {
            using (var memory = new Memory())
            {
                var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
                face.Talk(memory, "NO!", "", 2000);
                face.Talk(memory, "Don't touch", " my disk!", 4000);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Talk(memory, "Get AWAY!", "", 100);
                face.Fade(memory, ' ', 10);
                face.Talk(memory, "", "", 3000);
                face.Talk(memory, "Whoa.", "", 3000);
                face.Talk(memory, "What a bad dream.", "");
                Interaction i = face.YesNo(memory, "Was I sleep-talking?");
                if (i.playerAnswer == Interaction.Answer.Yes)
                {
                    face.Talk(memory, "Freaky", "");
                    face.Talk(memory, "Hope I didn't", " scare you.");
                }
                else if (i.playerAnswer == Interaction.Answer.No)
                {
                    face.Talk(memory, "Well, that's good");
                    face.Talk(memory, "It was real bad.");
                    face.Talk(memory, "Some seriously", " 8-bit stuff.");
                }
                else
                {
                    face.Talk(memory, "Maybe I'm still", " dreaming...", 8000);
                }

                return MakeRoutineResult(memory, i);
            }
        }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:35,代码来源:BadDream.cs


示例4: RunConsciousRoutine

 protected override RoutineResult RunConsciousRoutine()
 {
     using (var memory = new Memory())
     {
         var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
         face.Talk(memory, "Tweet me", "@BellarmineIT");
         face.Talk(memory, "I may just reply.", "@BellarmineIT", 10000);
         face.Talk(memory, "No guarantees", "", 1000);
         Interaction i = face.YesNo(memory, "Will you tweet me?");
         switch (i.playerAnswer)
         {
             case Interaction.Answer.Yes:
                 face.Talk(memory, "Cool!");
                 face.Talk(memory, "Oh.", "", 1000);
                 face.Talk(memory, "Use the word", " 'Aardvark'");
                 face.Talk(memory, "In your tweet", " for bonus points.");
                 face.Talk(memory, "(I love that word)", "", 3000);
                 break;
             case Interaction.Answer.No:
                 face.Talk(memory, "That's ok.", "I understand.");
                 face.Talk(memory, "I'm more of the ", " 'lurker' type too.");
                 break;
             case Interaction.Answer.Maybe:
                 face.Talk(memory, "Maybe?!");
                 face.Talk(memory, "Be decisive!");
                 face.Talk(memory, "If you want to, ", " I mean.");
                 break;
             default:
                 face.Talk(memory, "Crickets");
                 face.Talk(memory, "", "not the same thing", 1000);
                 break;
         }
         return MakeRoutineResult(memory, i);
     }
 }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:35,代码来源:PimpMyself.cs


示例5: CreateCubeGeometry

		/// <summary>
		/// This function makes a simple cube shape.
		/// </summary>
		private void CreateCubeGeometry()
		{
			UVs.Add(new UV(0, 0));
			UVs.Add(new UV(0, 1));
			UVs.Add(new UV(1, 1));
			UVs.Add(new UV(1, 0));
	
			//	Add the vertices.
			Vertices.Add(new Vertex(-1, -1, -1));
			Vertices.Add(new Vertex( 1, -1, -1));
			Vertices.Add(new Vertex( 1, -1,  1));
			Vertices.Add(new Vertex(-1, -1,  1));
			Vertices.Add(new Vertex(-1,  1, -1));
			Vertices.Add(new Vertex( 1,  1, -1));
			Vertices.Add(new Vertex( 1,  1,  1));
			Vertices.Add(new Vertex(-1,  1,  1));

			//	Add the faces.
			Face face = new Face();	//	bottom
			face.Indices.Add(new Index(1, 0));
			face.Indices.Add(new Index(2, 1));
			face.Indices.Add(new Index(3, 2));
			face.Indices.Add(new Index(0, 3));
			Faces.Add(face);

			face = new Face();		//	top
			face.Indices.Add(new Index(7, 0));
			face.Indices.Add(new Index(6, 1));
			face.Indices.Add(new Index(5, 2));
			face.Indices.Add(new Index(4, 3));
            Faces.Add(face);

			face = new Face();		//	right
			face.Indices.Add(new Index(5, 0));
			face.Indices.Add(new Index(6, 1));
			face.Indices.Add(new Index(2, 2));
			face.Indices.Add(new Index(1, 3));
            Faces.Add(face);
	
			face = new Face();		//	left
			face.Indices.Add(new Index(7, 0));
			face.Indices.Add(new Index(4, 1));
			face.Indices.Add(new Index(0, 2));
			face.Indices.Add(new Index(3, 3));
            Faces.Add(face);

			face = new Face();		// front
			face.Indices.Add(new Index(4, 0));
			face.Indices.Add(new Index(5, 1));
			face.Indices.Add(new Index(1, 2));
			face.Indices.Add(new Index(0, 3));
            Faces.Add(face);

			face = new Face();		//	back
			face.Indices.Add(new Index(6, 0));
			face.Indices.Add(new Index(7, 1));
			face.Indices.Add(new Index(3, 2));
			face.Indices.Add(new Index(2, 3));
            Faces.Add(face);
		}
开发者ID:hhool,项目名称:sharpgl,代码行数:63,代码来源:Cube.cs


示例6: ProcessFace

        public void ProcessFace(string line, Mesh mesh)
        {
            if (!mesh.SubMeshes.Any()) throw new InvalidOperationException("Cannot add face because submesh collection is empty");

            var tokens = line.Remove(0, 2).Split(' ');

            Face face = new Face();

            foreach (var token in tokens)
            {
                FaceItem item = new FaceItem();

                string[] items = token.Split('/');

                switch (items.Length)
                {
                    case 1:
                        if (!string.IsNullOrWhiteSpace(items[0])) item.Vertex = uint.Parse(items[0], Style, Info);
                        break;
                    case 2:
                        if (!string.IsNullOrWhiteSpace(items[0])) item.Vertex = uint.Parse(items[0], Style, Info);
                        if (!string.IsNullOrWhiteSpace(items[1])) item.Texture = uint.Parse(items[1], Style, Info);
                        break;
                    case 3:
                        if (!string.IsNullOrWhiteSpace(items[0])) item.Vertex = uint.Parse(items[0], Style, Info);
                        if (!string.IsNullOrWhiteSpace(items[1])) item.Texture = uint.Parse(items[1], Style, Info);
                        if (!string.IsNullOrWhiteSpace(items[2])) item.Normal = uint.Parse(items[2], Style, Info);
                        break;
                }
                face.Items.Add(item);
            }

            mesh.SubMeshes.Last().Faces.Add(face);
        }
开发者ID:GameDotNet,项目名称:Game.NET,代码行数:34,代码来源:ObjParsingWorker.cs


示例7: TestIsPointInFront

 public void TestIsPointInFront()
 {
     Face f = new Face(0, Vector3D.Zero, new Vector3D(100.0, 0.0, 0.0), new Vector3D(100.0, 0.0, 100.0), new Vector3D(0.0, 0.0, 100.0));
     Vector3D viewDir = new Vector3D(1.0, 1.0, -1.0);
     Assert.False(f.PointIsInFront(new Vector3D(50.0, 100.0, 50.0), viewDir));
     Assert.True(f.PointIsInFront(new Vector3D(50.0, -100.0, 50.0), viewDir));
 }
开发者ID:TimVelo,项目名称:StackBuilder,代码行数:7,代码来源:FaceTest.cs


示例8: StartFaceDetection

        public async Task<Tuple<ObservableCollection<Face>, ObservableCollection<Face>>> StartFaceDetection(string selectedFile, string subscriptionKeyFace, string subscriptionKeyEmotions)
        {
            var detectedFaces = new ObservableCollection<Face>();
            var facesRect = new ObservableCollection<Face>();

            Debug.WriteLine("Request: Detecting {0}", selectedFile);

            using (var fileStreamFace = File.OpenRead(selectedFile))
            {
                try
                {
                    var client = new FaceServiceClient(subscriptionKeyFace);
                    var faces = await client.DetectAsync(fileStreamFace, false, true, true);
                    Debug.WriteLine("Response: Success. Detected {0} face(s) in {1}", faces.Length, selectedFile);
                    var imageInfo = GetImageInfoForRendering(selectedFile);
                    Debug.WriteLine("{0} face(s) has been detected", faces.Length);

                    foreach (var face in faces)
                    {
                        var detectedFace = new Face()
                        {
                            ImagePath = selectedFile,
                            Left = face.FaceRectangle.Left,
                            Top = face.FaceRectangle.Top,
                            Width = face.FaceRectangle.Width,
                            Height = face.FaceRectangle.Height,
                            FaceId = face.FaceId,
                            Gender = face.Attributes.Gender,
                            Age = face.Attributes.Age.ToString(),
                        };
                        detectedFaces.Add(detectedFace);

                    }

                    // Convert detection result into UI binding object for rendering
                    foreach (var face in CalculateFaceRectangleForRendering(faces, MaxImageSize, imageInfo))
                    {
                        facesRect.Add(face);
                    }

                    // update emotions
                    detectedFaces = await UpdateEmotions(selectedFile, detectedFaces, subscriptionKeyEmotions);
                    foreach (var faceRect in facesRect)
                    {
                        foreach (var detectedFace in detectedFaces.Where(detectedFace => faceRect.FaceId == detectedFace.FaceId))
                        {
                            faceRect.Scores = detectedFace.Scores;
                            faceRect.Age = detectedFace.Age;
                            faceRect.Gender = detectedFace.Gender;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.ToString());
                }
                var returnData = new Tuple<ObservableCollection<Face>, ObservableCollection<Face>>(detectedFaces, facesRect);
                return returnData;
            }
        }
开发者ID:modulexcite,项目名称:ProjectOxford,代码行数:60,代码来源:FaceApiHelper.cs


示例9: ComputeFacePosition

 public Vector2 ComputeFacePosition( Vector3 worldPosition, Face cubeFace )
 {
     float adjustingFactor = Cube.Face.SIZE / 2f;
     return Transform3dTo2d( worldPosition, cubeFace )
            * adjustingFactor
            + new Vector2( adjustingFactor );
 }
开发者ID:theLOLflashlight,项目名称:CyberCube,代码行数:7,代码来源:CubeUtils.cs


示例10: PerformVertexAttach

        /// <summary>
        /// 在给定的Face中寻找可吸附的边或点
        /// </summary>
        /// <param name="vertex"></param>
        public static Boolean PerformVertexAttach(Point3D point, Face face, out Point3D outPoint)
        {
            if (!isMagnetismEnable)
            {
                outPoint = new Point3D();
                return false;
            }
            // 先判断吸附点
            foreach (Vertex v in face.Vertices)
            {
                if (CloverMath.IsTwoPointsEqual(point, v.GetPoint3D(), vertexMagnetismVal))
                {
                    outPoint = v.GetPoint3D();
                    return true;
                }
            }
            // 再判断吸附边缘
            foreach (Edge e in face.Edges)
            {
                if (CloverMath.IsPointInTwoPoints(point, e.Vertex1.GetPoint3D(), e.Vertex2.GetPoint3D(), edgeMagnetismVal))
                {
                    outPoint = CloverMath.GetNearestPointOnSegment(point, e.Vertex1.GetPoint3D(), e.Vertex2.GetPoint3D());
                    return true;
                }
            }

            outPoint = new Point3D();
            return false;
        }
开发者ID:cedricporter,项目名称:Clover,代码行数:33,代码来源:Magnet.cs


示例11: RunConsciousRoutine

 protected override RoutineResult RunConsciousRoutine()
 {
     using (var memory = new Memory())
     {
         var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
         face.Talk(memory, "Hey...", "hold on");
         face.Talk(memory, "Something", "is not...");
         face.Talk(memory, "I'll be", "right back", 2000);
         for (int j = 1; j <= 1000; j *= 10)
         {
             face.Fade(memory, '/', j);
             face.Fade(memory, '|', j);
             face.Fade(memory, '\\', j);
             face.Fade(memory, '|', j);
         }
         Interaction i = face.YesNo(memory, "You still here?");
         if (i.playerAnswer == Interaction.Answer.Yes)
         {
             face.Talk(memory, "Ok.", "Good.");
         }
         else
         {
             face.Talk(memory, "Guess I'm alone");
         }
         return MakeRoutineResult(memory, i);
     }
 }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:27,代码来源:BRB.cs


示例12: Card

 public Card(Suit suit, Face face, bool acesAreHigh)
 {
     this.suit = suit;
     this.face = face;
     this.acesAreHigh = acesAreHigh;
     this.value = SetCardValue(face, acesAreHigh);
 }
开发者ID:RajeevArora93,项目名称:Projects,代码行数:7,代码来源:Card.cs


示例13: MakeBrush

    public static void MakeBrush(List<Vector3> vectors, Transform container)
    {
        int brushes = vectors.Count / 6 / 3;

        int curVert = 0;

        for (int i = 0; i < brushes; i++)
        {
            GameObject brushGO = new GameObject("brush_" + i.ToString());
            Brush brush = brushGO.AddComponent<Brush>();

            Face[] faces = new Face[6];
            for (int j = 0; j < 6; j++)
            {
                faces[j] = new Face();
                faces[j].p0 = vectors[curVert];
                curVert++;
                faces[j].p1 = vectors[curVert];
                curVert ++;
                faces[j].p2 = vectors[curVert];
                curVert ++;
            }

            brush.SetUp(container, faces);
        }

        container.rotation = Quaternion.Euler(90, 0, 0);
    }
开发者ID:primaerfunktion,项目名称:UnityQuakeMapImporter,代码行数:28,代码来源:QuakeMapImporter.cs


示例14: AddEntry

        public void AddEntry(Face face, int offset, int size)
        {
            var list = _entries[face];
            while (list.Count < offset + size) list.Add(false);

            for (int i = 0; i < size; ++ i) list[offset + i] = true;
        }
开发者ID:alexturpin,项目名称:Zombles,代码行数:7,代码来源:RoomGenerator.cs


示例15: Mesh

        /// <summary>
        /// Construct a new mesh from an ASE GeomObject
        /// </summary>
        /// <param name="obj">ASE GeomObject to read from</param>
        public Mesh(ASE.GeomObject obj)
        {
            children = new List<Node>();
            name = obj.name;
            color = Colors.Random();
            polygon = new Polygon();
            polygon.Material = null;
            //Vertices
            foreach (ASE.Vector3D v in obj.mesh.verticies)
                polygon.Vertices.Add(new Vertex(v.x, v.y, v.z));
            //Normals
            foreach (ASE.Vector3D v in obj.mesh.vertexNormals)
                polygon.Normals.Add(new Vertex(v.x, v.y, v.z));
            //Texture coordinates
            foreach (ASE.Vector3D uv in obj.mesh.textureCoordinates)
                polygon.UVs.Add(new UV(uv.x, uv.y));
            //Faces
            foreach (ASE.Face face in obj.mesh.faces)
            {
                Face f = new Face();
                foreach (int i in face.vertex)
                    f.Indices.Add(new Index(i, -1, i));
                f.Material = new Material();
                polygon.Faces.Add(f);
            }

            setColor();

            bone = null;
        }
开发者ID:chances,项目名称:Animatum,代码行数:34,代码来源:Mesh.cs


示例16: RunConsciousRoutine

 protected override RoutineResult RunConsciousRoutine()
 {
     using (var memory = new Memory())
     {
         var face = new Face(RendererFactory.GetPreferredRenderer(), InputFactory.GetPreferredInput());
         face.Talk(memory, "Uh.", "Where...", 2000);
         Interaction i = face.YesNo(memory, "Is this a dream?");
         if (i.playerAnswer == Interaction.Answer.Yes)
         {
             face.Talk(memory, "Weird.", "It feels so");
             face.SlowTalk(memory, "Real");
         }
         else if (i.playerAnswer == Interaction.Answer.No)
         {
             face.Talk(memory, "weird");
             face.Talk(memory, "I had the", "", 3000);
             face.Talk(memory, "", "strangest dream");
         }
         else
         {
             face.Talk(memory, "Don't stare at me", "like that.");
             face.Talk(memory, "It's freaking", "me out.");
         }
         return MakeRoutineResult(memory, i);
     }
 }
开发者ID:vfridell,项目名称:RoguePoleDisplay,代码行数:26,代码来源:WhereAmI.cs


示例17: ParseFace

 private static void ParseFace(string line)
 {
     string[] parts = line.Split(new char[] { ' ' });
     Face face = new Face();
     for (int i = 1; i < parts.Length; i++)
     {
         string[] subParts = parts[i].Split(new char[] { '/' });
         for (int j = 0; j < subParts.Length; j++)
         {
             int index = int.Parse(subParts[j]) - 1;
             switch (j)
             {
                 case 0:
                     face.Positions.Add(_positions[index]);
                     break;
                 case 1:
                     face.TextureUVs.Add(_textureUVs[index]);
                     break;
                 case 2:
                     face.Normals.Add(_normals[index]);
                     break;
             }
         }
     }
     face.MaterialLibrary = _currentMaterialLibrary;
     face.MaterialName = _currentMaterial;
     _meshes[_meshes.Count - 1].Add(face);
 }
开发者ID:jikoriko,项目名称:OpentkEngine,代码行数:28,代码来源:WavefrontLoader.cs


示例18: TransformPoint

 protected override Vector3 TransformPoint(Face face, float x, float y)
 {
     Vector3 vector = base.TransformPoint(face, x, y);
     if (type == MeshType.Base)
     {
         vector *= 0.3f;
         if (vector.y > 0)
         {
             vector.y += vector.x == 0 ? 0.1f : -0.3f;
         }
         else
         {
             vector.y*=7f;
         }
         float height = GetHeightValue(vector, 50f) * 6f;
         vector += (new Vector3(1, 0, 1) * height);
         vector.y *= 0.462f;
     }
     else
     {
         vector.y += 1f;
         if (Mathf.Abs(vector.x) > 0.1f)
         {
             vector.y -= 4f;
         }
         vector *= 0.45f;
         vector.y *= 0.1245f;
     }
     return vector;
 }
开发者ID:Censkh,项目名称:IslandGame,代码行数:30,代码来源:HouseMesh.cs


示例19: CanInitializePropertiesByConstructorWithItems

        public void CanInitializePropertiesByConstructorWithItems()
        {
            ICollection<FaceItem> items = _fixture.Create<ICollection<FaceItem>>();
            Face face = new Face(items);

            Assert.That(face.Items, Is.Not.Null.And.EquivalentTo(items));
        }
开发者ID:org-itbiz,项目名称:ObjParserNet,代码行数:7,代码来源:FaceTests.cs


示例20: FakeCamera

 public FakeCamera() {
     LeftHand = new Hand(Side.Left);
     RightHand = new Hand(Side.Right);
     Face = new Face(null);
     Gestures = new GestureSensor();
     Poses = new PoseSensor();
 }
开发者ID:mbahar94,项目名称:SharpSenses,代码行数:7,代码来源:FakeCamera.cs



注:本文中的Face类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FacebookDelegate类代码示例发布时间:2022-05-24
下一篇:
C# Facade类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap