本文整理汇总了C#中FrameType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FrameType.ToString方法的具体用法?C# FrameType.ToString怎么用?C# FrameType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameType
的用法示例。
在下文中一共展示了FrameType.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Name
public static String Name(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name + "-Centred Inertial";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.referenceBody.name + "-" + selected.name +
" Barycentric";
}
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例2: Description
public static String Description(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return "Non-rotating reference frame fixing the centre of " +
selected.theName;
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Describing barycentric rotating frame of root body");
} else {
return "Reference frame fixing the barycentre of " +
selected.theName + " and " + selected.referenceBody.theName +
", the plane in which they move about the barycentre, and" +
" the line between them";
}
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例3: Name
public static String Name(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name + "-Centred Inertial";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.referenceBody.name + "-" + selected.name +
" Barycentric";
}
case FrameType.BODY_CENTRED_PARENT_DIRECTION:
if (selected.is_root()) {
throw Log.Fatal(
"Naming parent-direction rotating frame of root body");
} else {
// TODO(egg): find a proper name...
return selected.name + "-Centred " + selected.referenceBody.name +
"-Fixed";
}
case FrameType.BODY_SURFACE:
return selected.name + "-Centred " + selected.name + "-Fixed";
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例4: ShortName
public static String ShortName(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name[0] + "CI";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal(
"Naming parent-direction rotating frame of root body");
} else {
return selected.referenceBody.name[0] + (selected.name[0] + "B");
}
case FrameType.BODY_CENTRED_PARENT_DIRECTION:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.name[0] + "C" + selected.referenceBody.name[0] +
"F";
}
case FrameType.BODY_SURFACE:
return selected.name[0] + "C" + selected.name[0] + "F";
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例5: IndexFrameType
/// <summary>
/// Search the given frame hierarchy for all frames of a given type (sockets, effectors, etc.).
/// Return an array containing references to these frames, sorted in order, so that
/// "skt0" is in array[0], etc. Used to give cells rapid access to their joints and effectors
/// for physics & animation.
/// Note: array will be no larger than is needed to contain all the named frames. Array may be of zero size but will never be null.
/// If any indices are missing (e.g. anim0 and anim2 exist but not anim1) then the unused array entries will be null
/// and a trace warning will be emitted.
/// </summary>
/// <param name="root">The root frame for the hierarchy</param>
/// <param name="type">The type of frame to return</param>
/// <returns>The array of JointFrames</returns>
public static JointFrame[] IndexFrameType(JointFrame root, FrameType type)
{
int num = 0;
JointFrame[] array = new JointFrame[50]; // A big enough array
RecurseFrameType(type, array, root); // fill the elements
for (num=array.Length; (num>0)&&(array[num-1]==null); num--); // find out how many entries were filled
JointFrame[] array2 = new JointFrame[num]; // copy elements into a correctly-sized array
Array.Copy(array,0,array2,0,num); // (Possibly zero-length)
for (int i=0; i<num; i++) // scan the array for any missing elements and
{ // emit a trace warning - cell designer might have
if (array2[i]==null) // made a mistake!
{
Trace.WriteLine("WARNING: Unable to find a frame of type "+type.ToString()+" with index "+i);
}
}
return array2; // any unused entries will be null
}