本文整理汇总了C#中Vector3D类的典型用法代码示例。如果您正苦于以下问题:C# Vector3D类的具体用法?C# Vector3D怎么用?C# Vector3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3D类属于命名空间,在下文中一共展示了Vector3D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:notten,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCompositeShapeOreDeposit.cs
示例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;
}
开发者ID:kevincwq,项目名称:UAV,代码行数:10,代码来源:Orientation3D.cs
示例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];
//}
}
开发者ID:hksonngan,项目名称:sharptracing,代码行数:31,代码来源:LoaderByuModel.cs
示例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;
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:7,代码来源:Triangle.cs
示例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;
}
开发者ID:elitepilot,项目名称:mooege,代码行数:31,代码来源:Portal.cs
示例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);
}
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:7,代码来源:MyVoxelCoordSystems.cs
示例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);
}
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:29,代码来源:MyLodMeshMergeHandler.cs
示例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);
}
开发者ID:roice3,项目名称:Honeycombs,代码行数:7,代码来源:SphericalModels.cs
示例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();
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:32,代码来源:Triangle2.cs
示例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;
}
开发者ID:ndech,项目名称:PlaneSimulator,代码行数:7,代码来源:AirplanePhysicalModel.cs
示例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;
}
开发者ID:zaki,项目名称:irrlicht.net,代码行数:7,代码来源:RotateAnimator.cs
示例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;
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:29,代码来源:MyRenderComponentWheel.cs
示例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;
}
}
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:32,代码来源:zhujiangModels.cs
示例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;
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:12,代码来源:Gjk.cs
示例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);
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:Vector3DTests.cs
示例16: Move
public static void Move(TriMesh mesh, Vector3D vec)
{
foreach (var v in mesh.Vertices)
{
v.Traits.Position += vec;
}
}
开发者ID:meshdgp,项目名称:MeshDGP,代码行数:7,代码来源:TriMeshInverse.cs
示例17: Evaluate
//called each frame by vvvv
public void Evaluate(int SpreadMax)
{
//update particles and remove timed out particles
for (int i = FParticles.Count - 1; i >= 0; i--)
if (!FParticles[i].Update(FHDEHost.GetCurrentTime()))
FParticles.RemoveAt(i);
for (int i = 0; i < SpreadMax; i++) {
//add new particles
if (FBang[i]) {
for (int j = 0; j < 4; j++) {
var vel = new Vector3D(0, FRandom.NextDouble() + 0.3, FRandom.NextDouble() - 0.5);
// vel.z = 0;
var acc = new Vector3D(0,0, FAcc[0]);
FParticles.Add(new Particle(FHDEHost.GetCurrentTime(), FMaxLifeTime[i], FInput[i], vel, acc));
}
}
}
//set outputs
FOutput.SliceCount = FParticles.Count;
FAge.SliceCount = FParticles.Count;
for (int i = 0; i < FParticles.Count; i++) {
FOutput[i] = FParticles[i].Position;
FAge[i] = FParticles[i].Age;
}
}
开发者ID:velcrome,项目名称:Foosball3000,代码行数:28,代码来源:AnimationMySprayNode.cs
示例18: CreateSlicePixelData
public override byte[] CreateSlicePixelData(Vector3D imagePositionPatient)
{
var rowOrientation = RowOrientationPatient;
var columnOrientation = ColumnOrientationPatient;
var stackOrientation = rowOrientation.Cross(columnOrientation).Normalize();
// VTK reslice axes are in the volume coordinate system and should be positioned at the center of the desired output image
var reslicePosition = imagePositionPatient + Columns*ColumnSpacing/2f*rowOrientation + Rows*RowSpacing/2f*columnOrientation;
reslicePosition = VolumeReference.ConvertToVolume(reslicePosition);
var resliceAxes = new Matrix(new[,]
{
{rowOrientation.X, rowOrientation.Y, rowOrientation.Z, 0},
{columnOrientation.X, columnOrientation.Y, columnOrientation.Z, 0},
{stackOrientation.X, stackOrientation.Y, stackOrientation.Z, 0},
{0, 0, 0, 1}
});
resliceAxes = VolumeReference.RotateToVolumeOrientation(resliceAxes).Transpose();
resliceAxes.SetColumn(3, reslicePosition.X, reslicePosition.Y, reslicePosition.Z, 1);
if (Subsamples > 1)
{
// if subsampling is required, extract the thick slice ("slab") from the volume and then aggregate it using the specified projection method
return GetSlabPixelData(VolumeReference, resliceAxes, stackOrientation, Rows, Columns, Subsamples, RowSpacing, ColumnSpacing, SliceThickness, Interpolation, Projection);
}
else
{
// extract the (thin) slice from the volume
return GetSlicePixelData(VolumeReference, resliceAxes, Rows, Columns, RowSpacing, ColumnSpacing, Interpolation);
}
}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:31,代码来源:VtkVolumeSlicerCore.cs
示例19: Parse
public override void Parse(GameBitBuffer buffer)
{
Field0 = new Vector3D();
Field0.Parse(buffer);
Field1 = buffer.ReadInt(32);
Field2 = buffer.ReadInt(32);
}
开发者ID:loonbg,项目名称:mooege,代码行数:7,代码来源:ProjectileStickMessage.cs
示例20: MyAutopilotWaypoint
public MyAutopilotWaypoint(Vector3D coords, string name, List<MyObjectBuilder_ToolbarItem> actionBuilders, List<int> indexes, MyRemoteControl owner)
{
Coords = coords;
Name = name;
if (actionBuilders != null)
{
InitActions();
bool hasIndexes = indexes != null && indexes.Count > 0;
Debug.Assert(actionBuilders.Count <= MyToolbar.DEF_SLOT_COUNT);
if (hasIndexes)
{
Debug.Assert(indexes.Count == actionBuilders.Count);
}
for (int i = 0; i < actionBuilders.Count; i++)
{
if (actionBuilders[i] != null)
{
if (hasIndexes)
{
Actions[indexes[i]] = MyToolbarItemFactory.CreateToolbarItem(actionBuilders[i]);
}
else
{
Actions[i] = MyToolbarItemFactory.CreateToolbarItem(actionBuilders[i]);
}
}
}
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:31,代码来源:MyRemoteControl.cs
注:本文中的Vector3D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论