本文整理汇总了C#中Face类的典型用法代码示例。如果您正苦于以下问题:C# Face类的具体用法?C# Face怎么用?C# Face使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Face类属于命名空间,在下文中一共展示了Face类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: Parse
protected override void Parse(EndianBinaryReader r)
{
EID = ReadVarInt(r);
Title = ReadString8(r);
Position = CoordInt.Read(r);
FaceDirection = (Face)r.ReadByte();
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}
}
示例9: ComputeFacePosition
public Vector2 ComputeFacePosition( Vector3 worldPosition, Face cubeFace )
{
float adjustingFactor = Cube.Face.SIZE / 2f;
return Transform3dTo2d( worldPosition, cubeFace )
* adjustingFactor
+ new Vector2( adjustingFactor );
}
示例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;
}
示例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);
}
}
示例12: Card
public Card(Suit suit, Face face, bool acesAreHigh)
{
this.suit = suit;
this.face = face;
this.acesAreHigh = acesAreHigh;
this.value = SetCardValue(face, acesAreHigh);
}
示例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);
}
示例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;
}
示例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;
}