public static void DecreaseGridStep() { if (IsMinGridStep() == false) { m_gridStepMode = MyUtils.GetNextOrPreviousEnumValue(m_gridStepMode, false); } }
public static void InnerDistanceToBoundary(Ray ray, GridStep steps, Vector3 min, Vector3 max, ref RayHit rayHitX, ref RayHit rayHitY, ref RayHit rayHitZ) { if (steps.x >= 0) { rayHitX = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalLeft, max); } else { rayHitX = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalRight, min); } if (steps.y >= 0) { rayHitY = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalDown, max); } else { rayHitY = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalUp, min); } if (steps.z >= 0) { rayHitZ = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalBack, max); } else { rayHitZ = RayPlaneIntersectionCompute.RayPlaneIntersection(ray, GridNormalForward, min); } }
public static void LoadData() { m_gridStepMode = MyFakes.MWBUILDER ? GridStep.STEP_LEVEL_4 : GridStep.STEP_LEVEL_3; m_gridOrientation = GridOrientation.ORIENTATION_XY; m_gridColor = MyEditorConstants.COLOR_WHITE; m_isGridVisible = false; m_gridStepInMeters = GetGridStepInMeters(); }
public static GridStep DetermineGridStep(Ray ray) { GridStep step = new GridStep(); step.x = ray.direction.x >= 0 ? 1 : -1; step.y = ray.direction.y >= 0 ? 1 : -1; step.z = ray.direction.z >= 0 ? 1 : -1; return(step); }
public static void DistanceBetweenBoundary(Ray ray, GridStep steps, SpatialGridIndex entryGridIndex, SpatialGrid grids, Vector3 firstHitX, Vector3 firstHitY, Vector3 firstHitZ, ref RayHit rayHitX, ref RayHit rayHitY, ref RayHit rayHitZ) { Vector3 min = GetGridLocalMin(grids, entryGridIndex); Vector3 max = GetGridLocalMax(grids, entryGridIndex); Ray rX = SpatialGridTrace.CreateRay(firstHitX, ray.direction); Ray rY = SpatialGridTrace.CreateRay(firstHitY, ray.direction); Ray rZ = SpatialGridTrace.CreateRay(firstHitZ, ray.direction); if (steps.x >= 0) { rayHitX = RayPlaneIntersectionCompute.RayPlaneIntersection(rX, GridNormalLeft, max + GridNormalRight); } else { rayHitX = RayPlaneIntersectionCompute.RayPlaneIntersection(rX, GridNormalRight, min + GridNormalLeft); } if (steps.y >= 0) { rayHitY = RayPlaneIntersectionCompute.RayPlaneIntersection(rY, GridNormalDown, max + GridNormalUp); } else { rayHitY = RayPlaneIntersectionCompute.RayPlaneIntersection(rY, GridNormalUp, min + GridNormalDown); } if (steps.z >= 0) { rayHitZ = RayPlaneIntersectionCompute.RayPlaneIntersection(rZ, GridNormalBack, max + GridNormalForward); } else { rayHitZ = RayPlaneIntersectionCompute.RayPlaneIntersection(rZ, GridNormalForward, min + GridNormalBack); } }
private void RotateGrid(string _gridToRotateName, string _buttonToPressName) { GameObject gridToRotate = GameObject.Find(_gridToRotateName); if (_gridToRotateName == "CurveGrid" && _buttonToPressName == "CurveClockwiseRotationButton") { switch (CurrentCurveGridStep) { case GridStep.First: gridToRotate.GetComponent <Animator> ().Play("CurveGridFirstClockwiseRotation"); CurrentCurveGridStep = GridStep.Second; break; case GridStep.Second: gridToRotate.GetComponent <Animator> ().Play("CurveGridSecondClockwiseRotation"); CurrentCurveGridStep = GridStep.Third; break; case GridStep.Third: gridToRotate.GetComponent <Animator> ().Play("CurveGridThirdClockwiseRotation"); CurrentCurveGridStep = GridStep.Fourth; break; case GridStep.Fourth: gridToRotate.GetComponent <Animator> ().Play("CurveGridFourthClockwiseRotation"); CurrentCurveGridStep = GridStep.First; break; default: break; } } if (_gridToRotateName == "CurveGrid" && _buttonToPressName == "CurveCounterclockwiseRotationButton") { switch (CurrentCurveGridStep) { case GridStep.First: gridToRotate.GetComponent <Animator> ().Play("CurveGridFirstCounterclockwiseRotation"); CurrentCurveGridStep = GridStep.Fourth; break; case GridStep.Second: gridToRotate.GetComponent <Animator> ().Play("CurveGridSecondCounterclockwiseRotation"); CurrentCurveGridStep = GridStep.First; break; case GridStep.Third: gridToRotate.GetComponent <Animator> ().Play("CurveGridThirdCounterclockwiseRotation"); CurrentCurveGridStep = GridStep.Second; break; case GridStep.Fourth: gridToRotate.GetComponent <Animator> ().Play("CurveGridFourthCounterclockwiseRotation"); CurrentCurveGridStep = GridStep.Third; break; default: break; } } if (_gridToRotateName == "QuadGrid" && _buttonToPressName == "QuadClockwiseRotationButton") { switch (CurrentQuadGridStep) { case GridStep.First: CurrentQuadGridStep = GridStep.Second; gridToRotate.GetComponent <Animator> ().Play("QuadGridFirstClockwiseRotation"); break; case GridStep.Second: gridToRotate.GetComponent <Animator> ().Play("QuadGridSecondClockwiseRotation"); CurrentQuadGridStep = GridStep.Third; break; case GridStep.Third: gridToRotate.GetComponent <Animator> ().Play("QuadGridThirdClockwiseRotation"); CurrentQuadGridStep = GridStep.Fourth; break; case GridStep.Fourth: gridToRotate.GetComponent <Animator> ().Play("QuadGridFourthClockwiseRotation"); CurrentQuadGridStep = GridStep.First; break; default: break; } } if (_gridToRotateName == "QuadGrid" && _buttonToPressName == "QuadCounterclockwiseRotationButton") { switch (CurrentQuadGridStep) { case GridStep.First: gridToRotate.GetComponent <Animator> ().Play("QuadGridFirstCounterclockwiseRotation"); CurrentQuadGridStep = GridStep.Fourth; break; case GridStep.Second: gridToRotate.GetComponent <Animator> ().Play("QuadGridSecondCounterclockwiseRotation"); CurrentQuadGridStep = GridStep.First; break; case GridStep.Third: gridToRotate.GetComponent <Animator> ().Play("QuadGridThirdCounterclockwiseRotation"); CurrentQuadGridStep = GridStep.Second; break; case GridStep.Fourth: gridToRotate.GetComponent <Animator> ().Play("QuadGridFourthCounterclockwiseRotation"); CurrentQuadGridStep = GridStep.Third; break; default: break; } } }
private void WriteKKCSV(string KKCSVName) { // save the current settings to KK.csv List <string> lines = new List <string>(); // create a List<string> to hold all the output lines // each line of the output file, in output order lines.Add("Users Call," + Your_call); lines.Add("KKDevice," + ((int)KKDevice).ToString()); lines.Add("Band," + BandSelect.Text); lines.Add("Sample Rate," + SampleRate); lines.Add("Step Size," + stepSize.Text); lines.Add("Mode," + Mode.Text); lines.Add("Volume," + VolumeTrackBar.Value); lines.Add("Bandwidth," + BandwidthTrackBar.Value); lines.Add("Last Freq 160m," + set_frequency_160); lines.Add("Last Freq 80m," + set_frequency_80); lines.Add("Last Freq 40m," + set_frequency_40); lines.Add("Last Freq 30m," + set_frequency_30); lines.Add("Last Freq 20m," + set_frequency_20); lines.Add("Last Freq 17m," + set_frequency_17); lines.Add("Last Freq 15m," + set_frequency_15); lines.Add("Last Freq 12m," + set_frequency_12); lines.Add("Last Freq 10m," + set_frequency_10); lines.Add("Last Freq 6m," + set_frequency_6); lines.Add("Last Freq GC," + set_frequency_GC); lines.Add("Last frequency," + trackBarSetFrequency.Value); // we need to store the following controls as true or false, first we convert from bool to a string lines.Add("ANF," + (ANF.Checked).ToString()); lines.Add("NR," + (NR.Checked).ToString()); lines.Add("NB1," + (NB1.Checked).ToString()); lines.Add("NB2," + (NB2.Checked).ToString()); lines.Add("NB1 Threshold," + rcvr.BlockNBThreshold.ToString(nfi)); // use nfi to make floats region independent lines.Add("NB2 Threshold," + rcvr.AveNBThreshold.ToString(nfi)); lines.Add("Bandscope Average," + rcvr.PowerSpectrumAveragingOn.ToString()); lines.Add("Bandscope Smooth," + rcvr.PowerSpectrumSmoothingFactor.ToString(nfi)); lines.Add("Rate," + Rate.ToString()); // save the preamp setting for each band lines.Add("Preamp 160," + Preamp_160.ToString()); lines.Add("Preamp 80," + Preamp_80.ToString()); lines.Add("Preamp 40," + Preamp_40.ToString()); lines.Add("Preamp 30," + Preamp_30.ToString()); lines.Add("Preamp 20," + Preamp_20.ToString()); lines.Add("Preamp 17," + Preamp_17.ToString()); lines.Add("Preamp 15," + Preamp_15.ToString()); lines.Add("Preamp 12," + Preamp_12.ToString()); lines.Add("Preamp 10," + Preamp_10.ToString()); lines.Add("Preamp 6," + Preamp_6.ToString()); lines.Add("Preamp GC," + Preamp_GC.ToString()); // end of original kk.csv file. beginning of values that LookupKKCSVValue should be used on lines.Add("ANFAdaptiveFilterSize," + ANFAdaptiveFilterSize.ToString(nfi)); lines.Add("ANFDelay," + ANFDelay.ToString(nfi)); lines.Add("ANFAdaptationRate," + ANFAdaptationRate.ToString(nfi)); lines.Add("ANFLeakage," + ANFLeakage.ToString(nfi)); lines.Add("NRAdaptiveFilterSize," + NRAdaptiveFilterSize.ToString(nfi)); lines.Add("NRDelay," + NRDelay.ToString(nfi)); lines.Add("NRAdaptationRate," + NRAdaptationRate.ToString(nfi)); lines.Add("NRLeakage," + NRLeakage.ToString(nfi)); lines.Add("Bandscope Grid Max," + GridMax.ToString(nfi)); lines.Add("Bandscope Grid Min," + GridMin.ToString(nfi)); lines.Add("Bandscope Grid Step," + GridStep.ToString(nfi)); lines.Add("AGC Speed," + AGCSpeed.Text); lines.Add("AGC Fixed Gain," + AGCFixedGainDB.ToString(nfi)); lines.Add("AGC Hang Threshold," + AGCHangThreshold.ToString(nfi)); lines.Add("AGC Max Gain," + AGCMaximumGainDB.ToString(nfi)); lines.Add("AGC Slope," + AGCSlope.ToString(nfi)); lines.Add("AGC Attack Time," + UserAGCAttackTime.ToString(nfi)); // only variable for 'user' AGC lines.Add("AGC Decay Time," + UserAGCDecayTime.ToString(nfi)); // only variable for 'user' AGC lines.Add("AGC Hang Time," + UserAGCHangTime.ToString(nfi)); // only variable for 'user' AGC lines.Add("WaterfallHigh," + WaterfallHighThreshold.ToString(nfi)); lines.Add("WaterfallLow," + WaterfallLowThreshold.ToString(nfi)); lines.Add("WaterFall AGC," + WaterfallAGC.ToString(nfi)); lines.Add("Squelch level," + Squelch_level.Value.ToString(nfi)); lines.Add("Hermes," + Hermes.ToString(nfi)); lines.Add("PennyLane," + PennyLane.ToString(nfi)); lines.Add("Penny Present," + PenneyPresent.ToString(nfi)); lines.Add("Mic Gain 20dB," + MicGain20dB.ToString(nfi)); lines.Add("Atlas 10MHz," + Atlas10MHz.ToString(nfi)); lines.Add("Mercury 10MHz," + Mercury10MHz.ToString(nfi)); lines.Add("Penelope 10MHz," + Penelope10MHz.ToString(nfi)); lines.Add("Excalibur Present," + Excalibur.ToString(nfi)); lines.Add("Tx Filter High," + TxFilterHigh.ToString(nfi)); lines.Add("Tx Filter Low," + TxFilterLow.ToString(nfi)); lines.Add("Drive Level," + DriveLevel.Value.ToString(nfi)); lines.Add("Band Gain 160m," + Gain160m.ToString(nfi)); lines.Add("Band Gain 80m," + Gain80m.ToString(nfi)); lines.Add("Band Gain 60m," + Gain60m.ToString(nfi)); lines.Add("Band Gain 40m," + Gain40m.ToString(nfi)); lines.Add("Band Gain 30m," + Gain30m.ToString(nfi)); lines.Add("Band Gain 20m," + Gain20m.ToString(nfi)); lines.Add("Band Gain 17m," + Gain17m.ToString(nfi)); lines.Add("Band Gain 15m," + Gain15m.ToString(nfi)); lines.Add("Band Gain 12m," + Gain12m.ToString(nfi)); lines.Add("Band Gain 10m," + Gain10m.ToString(nfi)); lines.Add("Band Gain 6m," + Gain6m.ToString(nfi)); lines.Add("Full Duplex," + Duplex.ToString(nfi)); lines.Add("Only Tx on PTT," + OnlyTxOnPTT.ToString(nfi)); lines.Add("Tune Level," + TuneLevel.ToString(nfi)); lines.Add("CWPitch," + CWPitch.ToString(nfi)); lines.Add("Penny OC Enable," + PennyOC.ToString(nfi)); lines.Add("Penny OC 160mTx," + Penny160mTxOC.ToString(nfi)); lines.Add("Penny OC 80mTx," + Penny80mTxOC.ToString(nfi)); lines.Add("Penny OC 60mTx," + Penny60mTxOC.ToString(nfi)); lines.Add("Penny OC 40mTx," + Penny40mTxOC.ToString(nfi)); lines.Add("Penny OC 30mTx," + Penny30mTxOC.ToString(nfi)); lines.Add("Penny OC 20mTx," + Penny20mTxOC.ToString(nfi)); lines.Add("Penny OC 17mTx," + Penny17mTxOC.ToString(nfi)); lines.Add("Penny OC 15mTx," + Penny15mTxOC.ToString(nfi)); lines.Add("Penny OC 12mTx," + Penny12mTxOC.ToString(nfi)); lines.Add("Penny OC 10mTx," + Penny10mTxOC.ToString(nfi)); lines.Add("Penny OC 6mTx," + Penny6mTxOC.ToString(nfi)); lines.Add("Penny OC 160mRx," + Penny160mRxOC.ToString(nfi)); lines.Add("Penny OC 80mRx," + Penny80mRxOC.ToString(nfi)); lines.Add("Penny OC 60mRx," + Penny60mRxOC.ToString(nfi)); lines.Add("Penny OC 40mRx," + Penny40mRxOC.ToString(nfi)); lines.Add("Penny OC 30mRx," + Penny30mRxOC.ToString(nfi)); lines.Add("Penny OC 20mRx," + Penny12mRxOC.ToString(nfi)); lines.Add("Penny OC 17mRx," + Penny17mRxOC.ToString(nfi)); lines.Add("Penny OC 15mRx," + Penny15mRxOC.ToString(nfi)); lines.Add("Penny OC 12mRx," + Penny12mRxOC.ToString(nfi)); lines.Add("Penny OC 10mRx," + Penny10mRxOC.ToString(nfi)); lines.Add("Penny OC 6mRx," + Penny6mRxOC.ToString(nfi)); lines.Add("DelayRF," + DelayRF.ToString(nfi)); lines.Add("DelayPTT," + DelayPTT.ToString(nfi)); lines.Add("FM deviation," + FM_deviation.ToString(nfi)); lines.Add("Speech Processor," + chkClipper.Checked.ToString(nfi)); lines.Add("Processor Gain," + ProcessorGain.Value.ToString(nfi)); lines.Add("Bass Cut," + chkBassCut.Checked.ToString(nfi)); lines.Add("VOX On," + chkVOX.Checked.ToString(nfi)); lines.Add("VOX Level," + VOXLevel.Value.ToString(nfi)); VOXHang = (int)VOXHangTime.Value; lines.Add("VOX Hang," + VOXHang.ToString(nfi)); lines.Add("Mic Gain," + MicrophoneGain.Value.ToString(nfi)); lines.Add("Processor Gain," + ProcessorGain.Value.ToString(nfi)); lines.Add("Line In," + LineIn.ToString(nfi)); lines.Add("Last MAC," + MetisMAC); lines.Add("Mic AGC," + chkMicAGC.Checked.ToString(nfi)); lines.Add("Noise Gate," + chkNoiseGate.Checked.ToString(nfi)); lines.Add("Noise Gate Level," + NoiseGateLevel.Value.ToString(nfi)); lines.Add("Alex," + Alex.ToString(nfi)); lines.Add("Apollo," + Apollo.ToString(nfi)); lines.Add("Alex160mState," + Alex160mState.ToString(nfi)); lines.Add("Alex80mState," + Alex80mState.ToString(nfi)); lines.Add("Alex60mState," + Alex60mState.ToString(nfi)); lines.Add("Alex40mState," + Alex40mState.ToString(nfi)); lines.Add("Alex30mState," + Alex30mState.ToString(nfi)); lines.Add("Alex20mState," + Alex20mState.ToString(nfi)); lines.Add("Alex17mState," + Alex17mState.ToString(nfi)); lines.Add("Alex15mState," + Alex15mState.ToString(nfi)); lines.Add("Alex12mState," + Alex12mState.ToString(nfi)); lines.Add("Alex10mState," + Alex10mState.ToString(nfi)); lines.Add("Alex6mState," + Alex6mState.ToString(nfi)); lines.Add("AlexGCState," + AlexGCState.ToString(nfi)); lines.Add("SkipVersionCheck," + SkipVersionCheck.ToString(nfi)); // convert bool to 'true'/'false' lines.Add("Allow16kWidebandSamples," + Allow16kWidebandSamples.ToString(nfi)); // convert bool to 'true'/'false' lines.Add("DoFastEthernetConnect," + DoFastEthernetConnect.ToString(nfi)); // convert bool to 'true'/'false' lines.Add("EthernetHostIPAddress," + EthernetHostIPAddress.ToString(nfi)); // string lines.Add("Metis_IP_address," + Metis_IP_address.ToString(nfi)); // string // write all the lines File.WriteAllLines(KKCSVName, lines.ToArray()); }
public static void GetDeltaToBoundary(SpatialGridIndex entryGridIndex, SpatialGrid grids, Ray entryToBoundaryRay, GridStep steps, ref RayHit rayHitX, ref RayHit rayHitY, ref RayHit rayHitZ) { InnerDistanceToBoundary( entryToBoundaryRay, steps, GetGridLocalMin(grids, entryGridIndex), GetGridLocalMax(grids, entryGridIndex), ref rayHitX, ref rayHitY, ref rayHitZ); }
public static RayHit Trace(Ray cameraRay, SpatialGrid spatialGrid, List <int> geometryIndexList, List <RTTriangle_t> geometryList, int exclude) { RayHit bestHit = RayHit.CreateRayHit(); float t0 = float.NegativeInfinity; float t1 = float.PositiveInfinity; if (RayBoxIntersectionCompute.RayBoxIntersection(cameraRay, spatialGrid.min, spatialGrid.max, ref t0, ref t1)) { Vector3 entry = cameraRay.GetPoint(t1); GridStep step = DetermineGridStep(cameraRay); Ray entryToBoundaryRay = CreateRay(entry, cameraRay.direction); SpatialGridIndex entryGridIndex = SpatialGridCompute.GetGridIndexAtPoint(spatialGrid, entry); RayHit deltaX = new RayHit(); RayHit deltaY = new RayHit(); RayHit deltaZ = new RayHit(); SpatialGridCompute.GetDeltaToBoundary( entryGridIndex, spatialGrid, entryToBoundaryRay, step, ref deltaX, ref deltaY, ref deltaZ); RayHit distToNextX = new RayHit(); RayHit distToNextY = new RayHit(); RayHit distToNextZ = new RayHit(); SpatialGridCompute.DistanceBetweenBoundary( cameraRay, step, entryGridIndex, spatialGrid, deltaX.hitPoint, deltaY.hitPoint, deltaZ.hitPoint, ref distToNextX, ref distToNextY, ref distToNextZ ); float tx = deltaX.distance; float ty = deltaY.distance; float tz = deltaZ.distance; SpatialGridIndex current = entryGridIndex; #region Debug CubeController currentGridController = CubeGlobalData.Instance.GetGridAtIndex(current); JoeRayCaster.voxelsHitList.Clear(); JoeRayCaster.voxelsHitList.Add(currentGridController); #endregion //Debug bool hasHit = false; bool outside = false; do { bestHit = LocalGridTrace( cameraRay, current, geometryIndexList, geometryList, spatialGrid, -1); if (tx < ty) { if (tx < tz) { // Move On X current.x = current.x + step.x; tx += distToNextX.distance; } else { // Move On Z current.z = current.z + step.z; tz += distToNextZ.distance; } } else { if (ty < tz) { // Move On Y current.y = current.y + step.y; ty += distToNextY.distance; } else { // Move On Z current.z = current.z + step.z; tz += distToNextZ.distance; } } #region Debug currentGridController = CubeGlobalData.Instance.GetGridAtIndex(current); if (currentGridController != null) { JoeRayCaster.voxelsHitList.Add(currentGridController); } #endregion hasHit = (bestHit.distance < float.PositiveInfinity); outside = SpatialGridCompute.IsGridIndexOutsideGrid(spatialGrid, current); }while(!hasHit && !outside); } else { JoeRayCaster.voxelsHitList.Clear(); } return(bestHit); }