本文整理汇总了C#中Vector3D类的典型用法代码示例。如果您正苦于以下问题:C# Vector3D类的具体用法?C# Vector3D怎么用?C# Vector3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3D类属于命名空间,在下文中一共展示了Vector3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DebugDraw
public override void DebugDraw(ref Vector3D translation, ref Color materialColor)
{
Shape.DebugDraw(ref translation, materialColor);
VRageRender.MyRenderProxy.DebugDrawText3D(Shape.Center() + translation, "layered", Color.White, 1f, false);
m_oreDeposits.DebugDraw(ref translation, ref materialColor);
}
示例2: Orientation3D
/// <summary>
/// Instantiates a new Orientation object.
/// </summary>
public Orientation3D()
{
forwardVector = new Vector3D(1, 0, 0);
downVector = new Vector3D(0, 0, 1);
angleMeasurement = AngleMeasurement.Degrees;
}
示例3: ProcessNormalsPerVertex
protected void ProcessNormalsPerVertex(PointerToVertex[] pointersToVertex, int verticesCount)
{
Vector3D[] normalsPerVertex = new Vector3D[verticesCount];
for (int i = 0; i < this.triangles.Length; i++) {
normalsPerVertex[pointersToVertex[i].Vertex1 - 1] += this.triangles[i].Normal;
normalsPerVertex[pointersToVertex[i].Vertex2 - 1] += this.triangles[i].Normal;
normalsPerVertex[pointersToVertex[i].Vertex3 - 1] += this.triangles[i].Normal;
int percent = (int) (i * 100 / this.triangles.Length);
if ((percent % 5) == 0) {
this.OnElementLoaded((int) ((i * 100 / this.triangles.Length * 0.5)), ElementMesh.VertexNormal);
}
}
for (int i = 0; i < this.triangles.Length; i++) {
this.triangles[i].NormalOnVertex1 = normalsPerVertex[pointersToVertex[i].Vertex1 - 1];
this.triangles[i].NormalOnVertex1.Normalize();
this.triangles[i].NormalOnVertex2 = normalsPerVertex[pointersToVertex[i].Vertex2 - 1];
this.triangles[i].NormalOnVertex2.Normalize();
this.triangles[i].NormalOnVertex3 = normalsPerVertex[pointersToVertex[i].Vertex3 - 1];
this.triangles[i].NormalOnVertex3.Normalize();
int percent = (int) (i * 100 / this.triangles.Length);
if ((percent % 5) == 0) {
this.OnElementLoaded(50 + (int) ((i * 100 / this.triangles.Length * 0.5)), ElementMesh.VertexNormal);
}
}
normalsPerVertex = null;
//for (int i = 0; i < this.triangles.Length; i++) {
// this.triangles[i].NormalOnVertex1 = this.normalsPerVertex[this.pointersToVertex[i].Vertex1];
// this.triangles[i].NormalOnVertex2 = this.normalsPerVertex[this.pointersToVertex[i].Vertex2];
// this.triangles[i].NormalOnVertex3 = this.normalsPerVertex[this.pointersToVertex[i].Vertex3];
//}
}
示例4: ComputeArea
public double ComputeArea(Vector3D a, Vector3D b, Vector3D c)
{
double area = 0;
area = ((b - a).Cross(c - a)).Length() / 2.0;
return area;
}
示例5: Portal
public Portal(World world, int actorSNO, Vector3D position, Dictionary<int, TagMapEntry> tags)
: base(world, world.NewActorID, position, tags)
{
this.SNOId = actorSNO;
this.Destination = new ResolvedPortalDestination
{
WorldSNO = tags[(int)MarkerTagTypes.DestinationWorld].Int2,
};
if (tags.ContainsKey((int)MarkerTagTypes.DestinationLevelArea))
this.Destination.DestLevelAreaSNO = tags[(int)MarkerTagTypes.DestinationLevelArea].Int2;
if (tags.ContainsKey((int)MarkerTagTypes.DestinationActorTag))
this.Destination.StartingPointActorTag = tags[(int)MarkerTagTypes.DestinationActorTag].Int2;
else
Logger.Warn("Found portal {0}without target location actor", this.SNOId);
this.Field8 = this.SNOId;
this.Field2 = 16;
this.Field3 = 0;
this.CollFlags = 0x00000001;
// FIXME: Hardcoded crap; probably don't need to set most of these. /komiga
this.Attributes[GameAttribute.MinimapActive] = true;
this.Attributes[GameAttribute.Hitpoints_Max_Total] = 1f;
this.Attributes[GameAttribute.Hitpoints_Max] = 0.0009994507f;
this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = 3.051758E-05f;
this.Attributes[GameAttribute.Hitpoints_Cur] = 0.0009994507f;
this.Attributes[GameAttribute.TeamID] = 1;
this.Attributes[GameAttribute.Level] = 1;
}
示例6: WorldPositionToRenderCellCoord
public static void WorldPositionToRenderCellCoord(int lod, Vector3D referenceVoxelMapPosition, ref Vector3D worldPosition, out Vector3I renderCellCoord)
{
Vector3D tmp;
WorldPositionToLocalPosition(referenceVoxelMapPosition, ref worldPosition, out tmp);
tmp /= RenderCellSizeInMeters(lod);
Vector3I.Floor(ref tmp, out renderCellCoord);
}
示例7: MyLodMeshMerge
internal MyLodMeshMerge(MyClipmap parentClipmap, int lod, int lodDivisions, ref MatrixD worldMatrix, ref Vector3D massiveCenter, float massiveRadius, RenderFlags renderFlags)
{
Debug.Assert(parentClipmap != null, "Parent clipmap cannot be null");
Debug.Assert(lod >= 0, "Lod level must be non-negative");
Debug.Assert(lodDivisions >= 0, "Invalid number of lod divisions");
m_parentClipmap = parentClipmap;
m_lod = lod;
m_lodDivisions = lodDivisions;
if (m_lodDivisions <= 0)
return;
m_dirtyProxyIndices = new HashSet<int>();
m_cellProxyToAabbProxy = new Dictionary<MyClipmapCellProxy, int>();
m_boundingBoxes = new MyDynamicAABBTreeD(Vector3D.Zero);
int cellCount = lodDivisions*lodDivisions*lodDivisions;
m_mergeJobs = new MergeJobInfo[cellCount];
m_mergedLodMeshProxies = new MyClipmapCellProxy[cellCount];
m_trackedActors = new HashSet<MyActor>[cellCount];
for (int divideIndex = 0; divideIndex < cellCount; ++divideIndex)
{
m_mergedLodMeshProxies[divideIndex] = new MyClipmapCellProxy(new MyCellCoord(Lod, GetCellFromDivideIndex(divideIndex)), ref worldMatrix, massiveCenter, massiveRadius, renderFlags, true);
m_mergeJobs[divideIndex] = new MergeJobInfo { CurrentWorkId = 0, LodMeshesBeingMerged = new List<LodMeshId>(), NextPossibleMergeStartTime = MyCommon.FrameCounter };
m_trackedActors[divideIndex] = new HashSet<MyActor>();
m_dirtyProxyIndices.Add(divideIndex);
}
}
示例8: GnomonicToStereo
public static Vector3D GnomonicToStereo( Vector3D g )
{
g /= m_gScale;
double dot = g.Dot( g ); // X^2 + Y^2
double z = -1 / Math.Sqrt( dot + 1 );
return g*z / (z - 1);
}
示例9: TriangleTest
public TriangleTest(Vector3D a, Vector3D b, Vector3D c)
{
this.A = a;
this.B = b;
this.C = c;
Vector2D sa;
Vector2D sb;
Vector2D sc;
sa = new Vector2D(1, 5);
sb = new Vector2D(2, 3);
sc = new Vector2D(4, 2);
this.sA = sa;
this.sB = sb;
this.sC = sc;
triVertices.Add(A);
triVertices.Add(B);
triVertices.Add(C);
AB = (A - B).Length();
BC = (B - C).Length();
AC = (C - A).Length();
lengthOfTheEdge.Add(AB);
lengthOfTheEdge.Add(BC);
lengthOfTheEdge.Add(AC);
lengthOfTheEdge.Sort();
}
示例10: CalculateMoments
private Vector3D CalculateMoments(State state)
{
Vector3D vector = new Vector3D(0);
vector.Z += 0.2f * (_commands.LeftAileron - _commands.RightAileron);
vector.Y += 0.1f * (_commands.Elevator);
return vector;
}
示例11: RotationAnimator
public RotationAnimator(Vector3D p_RotationStart, Vector3D p_rotationEnd, uint p_durationMs)
{
m_rotationStart = p_RotationStart;
m_rotationEnd = p_rotationEnd;
m_durationMs = p_durationMs;
}
示例12: TrySpawnParticle
public bool TrySpawnParticle(Vector3D worldPosition)
{
if (!MyFakes.ENABLE_DRIVING_PARTICLES)
return false;
MyWheel wheel = Entity as MyWheel;
if(wheel == null)
return false;
var speedMultiplier = wheel.GetTopMostParent().Physics.LinearVelocity.Length() / MyGridPhysics.ShipMaxLinearVelocity();
var currentTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;
if (currentTime - m_lastGlobalEffectCreationTime < 5
|| currentTime - m_lastEffectCreationTime < m_effectCreationInterval * MyUtils.GetRandomFloat(0.9f * (1.5f - speedMultiplier), 1.1f / (0.25f + speedMultiplier)))
return false;
MyParticleEffect drivingEffect = null;
if (!MyParticlesManager.TryCreateParticleEffect(51, out drivingEffect))
return false;
m_lastEffectCreationTime = currentTime;
m_lastGlobalEffectCreationTime = m_lastEffectCreationTime;
drivingEffect.WorldMatrix = MatrixD.CreateTranslation(worldPosition);
drivingEffect.Preload = 1.0f;
var speedScaleMultiplier = 1.0f + speedMultiplier*6.0f;
drivingEffect.UserScale = 0.25f * speedScaleMultiplier;
return true;
}
示例13: ReadFromXMLNode
public virtual void ReadFromXMLNode(XmlNode node)
{
try
{
// Deal with model path, must be only one
LoadModelPathNode(node);
// Deal with the start position
XmlNode startPositionNode = node.SelectSingleNode(ModelXMLDefinition.StartPosition);
if (startPositionNode != null)
{
m_ptStartPoint = CPoint3DSerializer.ReadPoint(startPositionNode);
}
// Read the scaleDirection
XmlNode scaleDirectionNode = node.SelectSingleNode(ModelXMLDefinition.SacleDirection);
CPoint3D scaleDirection = CPoint3DSerializer.ReadPoint(scaleDirectionNode);
Vector3D vec = new Vector3D(scaleDirection.X, scaleDirection.Y, scaleDirection.Z);
if (vec.LengthSquared != 0)
{
vec.Normalize();
m_scaleDirection = vec;
}
}
catch (SystemException ex)
{
string errMsg = ex.Message + "\n" + ex.StackTrace;
vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
throw;
}
}
示例14: Initialize
/// <summary>
/// Prepares the simplex with two initial points.
/// </summary>
/// <param name="point1">The first point to initialize the simplex with.</param>
/// <param name="point2">The second point to initialize the simplex with.</param>
public void Initialize(Vector3D point1, Vector3D point2)
{
simplex[0] = point1;
simplex[1] = point2;
count = 2;
}
示例15: CreateFromVector2D
public void CreateFromVector2D()
{
var v = new Vector3D(new Vector2D(1, 2));
Assert.AreEqual(1, v.X);
Assert.AreEqual(2, v.Y);
Assert.AreEqual(0, v.Z);
}