本文整理汇总了C#中Trace.getMinDistinctionLength方法的典型用法代码示例。如果您正苦于以下问题:C# Trace.getMinDistinctionLength方法的具体用法?C# Trace.getMinDistinctionLength怎么用?C# Trace.getMinDistinctionLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace.getMinDistinctionLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: intersects
public override Intersection intersects(Trace trace)
{
Scientrace.Intersection firstIntersection = new Scientrace.Intersection(false, null);
Scientrace.Intersection currentintersection = new Scientrace.Intersection(false, null);
double? firstdistance = null;
double currentdistance;
SortedList slobjects = new SortedList();
//Console.WriteLine(this.tag+" HAS "+this.objects.Count+ " o3ds");
//copying (by reference of course) all objects to a sortedlist.
foreach (Object3d iobject3d in this.objects) {
//Console.WriteLine("POKING "+ iobject3d.tag);
slobjects.Add(iobject3d.parseOrder, iobject3d);
}
foreach (DictionaryEntry deObject3d in slobjects) {
Object3d iObject = (Object3d)deObject3d.Value;
//validating currentintersection:
currentintersection = iObject.intersectsBefore(trace, currentintersection);
/*if (currentintersection==null) { continue; }
if (currentintersection.enter==null) { continue; }
if (currentintersection.exit==null) { continue; } */
//currentintersection = iObject.intersects(trace);
/*foreach (Object3d iobject3d in this.objects) {
currentintersection = iobject3dl.intersects(trace);*/
REPARSE:
if (!currentintersection.intersects) {
continue; //no intersection with this object? Try next object in collection (continue)
}
if ((currentintersection.enter.loc-trace.traceline.startingpoint).dotProduct(trace.traceline.direction) < 0) {
//Console.WriteLine("Found object lies in the past! Skipping "+iObject.tag);
continue;
}// else {Console.WriteLine("not in the past, but :"+(currentintersection.enter.loc-trace.traceline.startingpoint).dotProduct(trace.traceline.direction));}
currentdistance = currentintersection.enter.loc.distanceTo(trace.traceline.startingpoint);
if (currentintersection.object3d == trace.currentObject) {
/* If you're inside an object and the beam meets the same object,
* it should only have an "enterloc" which is where the beam "leaves" the object. */
if (currentintersection.exit != null) { // .loc part after exit removed at 20131205
/* perhaps the intersection has found the object at the same starting point */
if (currentintersection.enter.loc.distanceTo(trace.traceline.startingpoint)
< trace.getMinDistinctionLength()) {
Console.WriteLine("New functionality: removing exit for "+currentintersection.object3d.tag);
currentintersection.removeExit();
goto REPARSE;
}
/* check this occuring warning out after internal reflections. Doesn't
* seem to cause any problems though. */
if (currentintersection.object3d != trace.currentObject) { // because if they are the same it seems like internal reflection
Console.WriteLine("WARNING @"+this.tag+": Collision ("+currentintersection.object3d.tag+")"+
" with current object ("+trace.currentObject.tag+")"+
" without leaving first \n-----\n"+
trace.ToCompactString()+ "\nentering: "+currentintersection.enter.loc.trico()+
"\nexit:"+currentintersection.exit.loc.tricon()+"-----");
} //endif (currentintersection.object3d != trace.currentObject)
continue;
/* else: if no exit location is set, we must be leaving the current object at "enter" */
} else { // Leaving the current object should return to the parent collection (environment?).
currentintersection.leaving = true;
}
/* else: if the colliding object isn't the current object */
} else {
// analogue as above but inverted: you cannot leave an object you're not inside.
if (currentintersection.exit == null) { // .loc part after exit removed at 20131205
//or can you?
//continue; NO LONGER ABORT PARSING HERE, BECAUSE:
//CONCLUSION:
//YES YOU CAN, think about an object within an object or a reflective layer
if (currentintersection.object3d.hasVolume) {
//Console.WriteLine("Leaving object with volume("+currentintersection.object3d.tag+"), but don't refract");
continue;
}
}
}
if (!firstIntersection.intersects) {
firstIntersection = currentintersection;
firstdistance = firstIntersection.enter.loc.distanceTo(trace.traceline.startingpoint);
continue;
}
/* below a firstInteraction is already set */
currentdistance = currentintersection.enter.loc.distanceTo(trace.traceline.startingpoint);
if (firstIntersection.leaving) {
/* in order to make "attached objects" change into one another the
* colliding object has to be found instead of the "leaving" border. */
/* object which are seperated from each other with less than the lights wavelength
* will be treated as connected to each other. Not first leaving previous border */
if (currentdistance - firstdistance < trace.getMinDistinctionLength()) {
firstIntersection = currentintersection;
firstdistance = currentdistance;
continue;
}
continue;
}
/* if (firstdistance == null) {
//.........这里部分代码省略.........