/// <summary> /// Inserts Gaussian noise into a bitmap. /// </summary> /// <param name="source">Bitmap to be processed</param> /// <param name="amount">Standard deviation of perturbation for each color channel.</param> /// <returns>New, speckled bitmap</returns> /// <remarks> /// This code uses Bitmap.GetPixel and SetPixel methods for clarity. An implementation using Bitmap.LockBits /// and then directly modifying the image data may be faster, espectially for large images. /// </remarks> public static Bitmap AddNoise(this Bitmap source, double amount) { if (source == null) { throw new ArgumentNullException("source"); } Bitmap bitmap = null; Bitmap tempBitmap = null; try { var generator = new GaussianRandom(0.0, amount, SampleUtilities.MakeRandomSeed()); tempBitmap = new Bitmap(source.Width, source.Height); for (int y = 0; y < tempBitmap.Height; y++) { for (int x = 0; x < tempBitmap.Width; x++) { var pixel = source.GetPixel(x, y); Color newPixel = AddPixelNoise(pixel, generator); tempBitmap.SetPixel(x, y, newPixel); } } bitmap = tempBitmap; tempBitmap = null; } finally { if (tempBitmap != null) { tempBitmap.Dispose(); } } return(bitmap); }
double GetReal(int i) { GaussianRandom norm = new GaussianRandom(); double po = Math.Abs(norm.NextGaussian(0, 0.3)); return(GetIdeal(i) * (1 + ((po * dopysk) / 100))); }
public GPSINSFilter(TimeSpan startTime, Vector3 startPos, Vector3 startVelocity, Quaternion orientation, SensorSpecifications sensorSpecifications) { _startTime = startTime; _orientation = orientation; _sensorSpecifications = sensorSpecifications; X0 = Matrix.Create(new double[n, 1] { { startPos.X }, { startPos.Y }, { startPos.Z }, // Position { startVelocity.X }, { startVelocity.Y }, { startVelocity.Z }, // Velocity { _orientation.X }, { _orientation.Y }, { _orientation.Z }, { _orientation.W }, // Quaternion }); // Make sure we don't reference the same object, but rather copy its values. // It is possible to set PostX0 to a different state than X0, so that the initial guess // of state is wrong. PostX0 = X0.Clone(); // We use a very low initial estimate for error covariance, meaning the filter will // initially trust the model more and the sensors/observations less and gradually adjust on the way. // Note setting this to zero matrix will cause the filter to infinitely distrust all observations, // so always use a close-to-zero value instead. // Setting it to a diagnoal matrix of high values will cause the filter to trust the observations more in the beginning, // since we say that we think the current PostX0 estimate is unreliable. PostP0 = 0.001 * Matrix.Identity(n, n); // Determine standard deviation of estimated process and observation noise variance // Process noise (acceleromters, gyros, etc..) _stdDevW = new Vector(new double[n] { _sensorSpecifications.AccelerometerStdDev.Forward, _sensorSpecifications.AccelerometerStdDev.Right, _sensorSpecifications.AccelerometerStdDev.Up, 0, 0, 0, 0, 0, 0, 0 }); // Observation noise (GPS inaccuarcy etc..) _stdDevV = new Vector(new double[m] { _sensorSpecifications.GPSPositionStdDev.X, _sensorSpecifications.GPSPositionStdDev.Y, _sensorSpecifications.GPSPositionStdDev.Z, // 0.001000, 0.001000, 0.001000, // 1000, 1000, 1000, _sensorSpecifications.GPSVelocityStdDev.X, _sensorSpecifications.GPSVelocityStdDev.Y, _sensorSpecifications.GPSVelocityStdDev.Z, }); I = Matrix.Identity(n, n); _zeroMM = Matrix.Zeros(m); _rand = new GaussianRandom(); _prevEstimate = GetInitialEstimate(X0, PostX0, PostP0); }
private void Initialize() { gaussianRandom = new GaussianRandom(rnd); phasePoints = new ObservableCollection <DataPoint>(); currentPhasePoints = new ObservableCollection <DataPoint>(); positionPoints = new ObservableCollection <DataPoint>(); velocityPoints = new ObservableCollection <DataPoint>(); accelerationPoints = new ObservableCollection <DataPoint>(); animationSpeed = 0; epsilon0 = 0.05; alpha = StartAlpha; omega = 2; r = 80; lCurrent = l = 300; rimBlockDistance = Math.Sqrt(L * L - R * R); rimCenter = new Point(CanvasHalfWidth - rimBlockDistance * 2 / 3, CanvasHalfHeight); currentX = rimBlockDistance; currentV = 0.0; currentA = 0.0; lastTime = 0.0; deltaTime = 0; dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimerTick; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); buttonsFlags = new bool[3] { false, false, false }; }
private static void MutateWeights(double[] weights) { int weightsSize = weights.Length; int itersCount = random.Next(weightsSize); if (itersCount == 0) { itersCount = 1; } var used = new HashSet <int>(); for (int iter = 0; iter < itersCount; iter++) { int i = random.Next(weightsSize); if (weightsSize > 1) { while (used.Contains(i)) { i = random.Next(weightsSize); } } double w = weights[i]; w += (GaussianRandom.NextGaussian() - GaussianRandom.NextGaussian()) * weightsMutationInterval; // w += (this.random.nextDouble() - this.random.nextDouble()) * // weightsMutationInterval; weights[i] = w; used.Add(i); } }
public float GetTime() { if (generatedTime < 0) { generatedTime = Mathf.Max(0, GaussianRandom.random(time[0], time[1])); } return(generatedTime); }
public void AddNoise() { p1 += (p1 - p0) * 0.08f * GaussianRandom.random(); float rotNoise = 3.0f; q1 = Quaternion.Euler(rotNoise * GaussianRandom.random(), rotNoise * GaussianRandom.random(), rotNoise * GaussianRandom.random()) * q1; // t1 += GaussianRandom.random() * 0.2f; }
public float GetRandomPositionY() { float num; do { num = GaussianRandom.Val(this.MeanY, this.StdDevY); }while ((num < 0f) || (num > 1f)); return(num); }
public void Next_Max6_GeneratesNumbersBetween0And6Inclusive() { IRandom random = new GaussianRandom(); for (int i = 0; i < 100; i++) { int value = random.Next(6); Assert.IsTrue(0 <= value && 6 >= value); } }
public void Next_Min5Max20_GeneratesNumbersBetween5And20Inclusive() { IRandom random = new GaussianRandom(); for (int i = 0; i < 100; i++) { int value = random.Next(5, 20); Assert.IsTrue(5 <= value && 20 >= value); } }
public void Sender(string IP, int port, Plant Plant) { // initialize a connection to the controller Client sender = new Client(IP, port); while (true) { Thread.Sleep(50); string message = ""; if (using_channel == true) { message += Convert.ToString("EP_" + EP_Controller.IP + ":" + EP_Controller.Port + "#"); // add end-point if canal is used } message += Convert.ToString("time_" + DateTime.UtcNow.ToString(Constants.FMT) + "#"); // attach observed states measurement for (int i = 0; i < Plant.get_yo().Length; i++) { // apply measurement noise var r = new GaussianRandom(); double noise = r.NextGaussian(0, config.plantConfig.meas_noise_std); message += "yo" + (i + 1) + "_" + (Plant.get_yo()[i] + noise).ToString() + "#"; } // attach controlled states measurement for (int i = 0; i < Plant.get_yc().Length; i++) { // apply measurement noise var r = new GaussianRandom(); double noise = r.NextGaussian(0, config.plantConfig.meas_noise_std); message += "yc" + (i + 1) + "_" + (Plant.get_yc()[i] + noise).ToString() + "#"; // send back the realized actuator value if (new_relalized_actuator_value == true) { // append the last actuator state message += "uc" + (i + 1) + "_" + Plant.get_uc()[i].ToString() + "#"; } } new_relalized_actuator_value = false; // refresh the new actuator value flag // remove the redundant delimiter message = message.Substring(0, message.LastIndexOf('#')); sender.Send(message); // log controlled state and actuator value (used for package delivery analysis) if (FLAG_LOG == true) { string log_text = Plant.get_yc()[0] + ":" + U_last; // pick height and control signal Helpers.WriteToLog(sb, filename: log_file_name, text: log_text); } } }
static Color AddPixelNoise(Color pixel, GaussianRandom generator) { int newR = (int)pixel.R + generator.NextInteger(); int newG = (int)pixel.G + generator.NextInteger(); int newB = (int)pixel.B + generator.NextInteger(); int r = Math.Max(0, Math.Min(newR, 255)); int g = Math.Max(0, Math.Min(newG, 255)); int b = Math.Max(0, Math.Min(newB, 255)); return(Color.FromArgb(r, g, b)); }
/// <summary> /// /// </summary> /// <param name="nextLevel">次の質問のレベル</param> /// <returns>実際に表示するマーブルの数</returns> public int NextQuestion() { var diff = GaussianRandom.Next(0, 1); currentMarbleCount = Mathf.RoundToInt(CurrentLevel + diff); if (currentMarbleCount <= 0) { currentMarbleCount = 1; } return(currentMarbleCount); }
protected override void WriteInfo(BinaryWriter w) { Random.Save(w); GaussianRandom.Save(w); w.Write(Width); w.Write(Height); w.Write(WorldHasEdges); w.Write(RegionSize); WriteListInfo(EntityList, w); }
public Accelerometer3Axis(SensorSpecifications sensorSpecifications, bool isPerfect) : base(isPerfect) { _gaussRand = new GaussianRandom(); _frequency = sensorSpecifications.AccelerometerFrequency; _rmsNoiseXY = sensorSpecifications.AccelerometerStdDev.Forward; _rmsNoiseZ = sensorSpecifications.AccelerometerStdDev.Up; _timeBetweenUpdates = (_frequency > 0) ? TimeSpan.FromSeconds(1.0 / _frequency) : TimeSpan.Zero; _isInitialized = false; }
Vector3 GenHitVector() { Vector3 hitVec = new Vector3(); hitVec.z = -(transform.position.z + GaussianRandom.generateNormalRandom(0, 1)); //Gaussian noise added to z. Range -23 to +23 depend on pos //positive x if player2, neg if player1 hitVec.x = 20; if (isPlayer1) { hitVec.x *= -1; } hitVec.y = 20 + GaussianRandom.generateNormalRandom(0, 3); return(hitVec); }
public Linear(int input, int output, Random r, Initializator init = null) { if (init == null) { init = new GaussianRandom(0, 1, 1, r); } var w = init.GenerateMatrix(input, output); var b = init.GenerateMatrix(1, output); var weights = new Tensor(w, true); var bias = new Tensor(b, true); parameters.Add(bias); parameters.Add(weights); }
public Vector2 GetRandomPosition() { float num; float num2; do { num = GaussianRandom.Val(this.MeanX, this.StdDevX); }while ((num < 0f) || (num > 1f)); do { num2 = GaussianRandom.Val(this.MeanY, this.StdDevY); }while ((num2 < 0f) || (num2 > 1f)); return(new Vector2(num, num2)); }
public ScalarKF(float gainA, float gainB, float gainH, float covarianceQ, float covarianceR) { // Starting with example _a = gainA; _b = gainB; _h = gainH; // Noise co-variances _q = covarianceQ; _r = covarianceR; // Determine standard deviation of estimated process and observation noise variance _stdDevW = (float)Math.Sqrt(_q); _stdDevV = (float)Math.Sqrt(_r); _rand = new GaussianRandom(); }
public void Restore_AfterGeneratingThreeNumbers_RegeneratesSameThreeNumbers() { IRandom random = new GaussianRandom(); for (int i = 0; i < 4; i++) { random.Next(6); } RandomState state = random.Save(); int first = random.Next(6); int second = random.Next(6); int third = random.Next(6); random.Restore(state); Assert.AreEqual(first, random.Next(6)); Assert.AreEqual(second, random.Next(6)); Assert.AreEqual(third, random.Next(6)); }
public NotationSystem(int quantity, double alphaf, double delta1) { delta = delta1; n = quantity; alpha = alphaf; ideal = new double[n]; real = new double[n]; norm = new GaussianRandom(); if (alphaf != -1.0) { for (int i = 0; i < n; i++) { ideal[i] = Math.Pow(alpha, i); } } else { alpha = 1.618; for (int i = 0; i < n; i++) { ideal[i] = Fibonachi.GetNFibonachi(i); } } for (int i = 0; i < n; i++) { if (ideal[i] * delta / 100 < ideal[0] / 2) { kilTochnux++; } } weightByHands = false; ReCountRealWeigths(); }
private static void MutateNeuronsFunctionsParams(Neuron[] neurons) { int neuronsSize = neurons.Length; int itersCount = random.Next(neuronsSize); if (itersCount == 0) { itersCount = 1; } var used = new HashSet <int>(); for (int iter = 0; iter < itersCount; iter++) { int i = random.Next(neuronsSize); if (neuronsSize > 1) { while (used.Contains(i)) { i = random.Next(neuronsSize); } } var n = neurons[i]; var Params = n.GetParams(); for (int j = 0; j < Params.Length; j++) { double param = Params[j]; param += (GaussianRandom.NextGaussian() - GaussianRandom.NextGaussian()) * neuronParamsMutationInterval; // param += (this.random.nextDouble() - // this.random.nextDouble()) * neuronParamsMutationInterval; Params[j] = param; } n.SetFunctionAndParams(n.TransferFunction, Params); used.Add(i); } }
Vector3 GenHitVector() //this will only be called if a player hit the ball { Vector3 hitVec = new Vector3(); hitVec.z = -(transform.position.z + GaussianRandom.generateNormalRandom(0, 3)); //Gaussian noise added to z. Range -23 to +23 depend on pos //positive x if player2, neg if player1 hitVec.x = 47; if (swing.playerId == "1") { //woman if (nextAudioHard) { fh.Play(0); } else { fs.Play(0); } updateLastHitter(true); hitVec.x *= -1; } else { if (nextAudioHard) { mh.Play(0); } else { ms.Play(0); } updateLastHitter(false); } hitVec.y = 10 + GaussianRandom.generateNormalRandom(0, 1); return(hitVec); }
public void GaussianDistributionTest() { try { if (Chart == null) { return; } try { Chart.Primitives.Clear(); var rand = new GaussianRandom(); float minY = float.MaxValue; float maxY = float.MinValue; var values = new float[100000]; for (int x = 0; x < values.Length; x++) { float val = rand.NextGaussian(0, 1); values[x] = val; if (val > maxY) { maxY = val; } if (val < minY) { minY = val; } } const int distributionSteps = 1000; float stepSizeY = (maxY - minY) / distributionSteps; var distributionBucketCount = new Point[distributionSteps]; // Set X-positions for all points for (int i = 0; i < distributionBucketCount.Length; i++) { distributionBucketCount[i].X = MyMathHelper.Lerp(i, 0, distributionBucketCount.Length, 0, values.Length); } // Increase Y-position by one for each bucket hit foreach (float valY in values) { int bucketIndex = Convert.ToUInt16(Math.Min(distributionSteps - 1, (valY - minY) / stepSizeY)); distributionBucketCount[bucketIndex].Y++; } SwordfishGraphHelper.AddLineXY(Chart, "Gaussian values", Colors.Gray, values); SwordfishGraphHelper.AddLineXY(Chart, "Distribution bucket count", Colors.Red, distributionBucketCount); Chart.Title = "GaussianDistributionTest()"; Chart.XAxisLabel = "X Axis"; Chart.YAxisLabel = "Y Axis"; Chart.RedrawPlotLines(); } catch (Exception e) { MessageBox.Show(e.ToString()); Console.WriteLine(e); } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
private static void HandleCreateItemOp(Character pChar, int nItemID, bool bStimulantUsed, List <int> aGems) { // BEGIN VERIFICATION //var pMakerItem = MasterManager.EtcTemplates.MakerData(nItemID); var makerItem = MasterManager.ItemMakeTemplates[nItemID]; // verify maker item exists if (makerItem is null) { pChar.SendMessage("Null item maker template."); return; } // verify player is high enough level to use recipe if (makerItem.ReqLevel > pChar.Stats.nLevel + 6) { pChar.SendMessage("Verify the item level you're trying to craft is no more than 6 above your own."); return; } // verify player has enough meso if (makerItem.Meso > pChar.Stats.nMoney) { pChar.SendMessage("Verify you have the correct amount of mesos."); return; } var pCharMakerSkill = pChar.Skills.Get(Common.GameLogic.SkillLogic.get_novice_skill_as_race(Common.GameLogic.SkillLogic.NoviceSkillID.MakerSkill, pChar.Stats.nJob)); // verify player maker skill level is high enough if (makerItem.ReqSkillLevel > (pCharMakerSkill?.nSLV ?? 0)) { pChar.SendMessage($"Verify maker skill level. {makerItem.ReqSkillLevel} < {(pCharMakerSkill?.nSLV ?? 0)}"); return; } var(nStimulantItemSlot, pStimulantItem) = InventoryManipulator.GetAnyItem(pChar, InventoryType.Etc, makerItem.CatalystID); // verify stimulant (catalyst) exists in player inventory if (bStimulantUsed && pStimulantItem is null) { pChar.SendMessage("Verify you possess the correct stimulant item."); return; } // verify equip slot availability if (InventoryManipulator.CountFreeSlots(pChar, InventoryType.Equip) < 1) { pChar.SendMessage("Please make more room in your equip inventory."); return; } if (InventoryManipulator.CountFreeSlots(pChar, InventoryType.Etc) < makerItem.RandomReward.Length) { pChar.SendMessage("Please make more room in your etc inventory."); return; } // verify required items exist in player inventory if (makerItem.Recipe.Any(item => !InventoryManipulator.ContainsItem(pChar, item.ItemID, (short)item.Count))) { pChar.SendMessage("Verify you possess all the required components."); return; } var aGemItemIds = new List <int>(); var aGemItemTypes = new List <int>(); // remove duplicate items/types and get item slots for gems foreach (var entry in aGems) { var(nGemSlot, pGemItem) = InventoryManipulator.GetAnyItem(pChar, InventoryType.Etc, entry); if (pGemItem is null || nGemSlot == 0 || !(pGemItem.Template is GemEffectTemplate)) { continue; } // idk how it would be 0 but we check anyway if (!aGemItemTypes.Contains(entry / 100) && !aGemItemIds.Contains(pGemItem.nItemID) && pGemItem.nNumber > 0) { aGemItemIds.Add(pGemItem.nItemID); aGemItemTypes.Add(entry / 100); } } // END VERIFICATION // BEGIN RECIPE PROCESSING // remove meso cost from inventory if (makerItem.Meso > 0) { pChar.Modify.GainMeso(-makerItem.Meso); } // remove stimulant from inventory if (bStimulantUsed) { InventoryManipulator.RemoveQuantity(pChar, pStimulantItem.nItemID, 1); } // remove recipe items from inventory foreach (var item in makerItem.Recipe) { InventoryManipulator.RemoveQuantity(pChar, item.ItemID, (short)item.Count); } var bSuccess = true; if (bStimulantUsed && Constants.Rand.Next(100) >= 90) { bSuccess = false; } else { // BEGIN MAKER ITEM CREATION var pNewItemRaw = MasterManager.CreateItem(makerItem.TemplateId); if (pNewItemRaw is GW_ItemSlotEquip pNewItemEquip) { pNewItemEquip.RemainingUpgradeCount = (byte)makerItem.TUC; // remove gems from inventory foreach (var nGemItemId in aGemItemIds) { var pGemItemRaw = InventoryManipulator.GetAnyItem(pChar, InventoryType.Etc, nGemItemId).Item2; if (pGemItemRaw.Template is GemEffectTemplate pGemItem) { // gems only have one modifier each if (pGemItem.incPAD > 0) { pNewItemEquip.niPAD += (short)(pGemItem.incPAD * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incPDD > 0) { pNewItemEquip.niPDD += (short)(pGemItem.incPDD * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incMAD > 0) { pNewItemEquip.niMAD += (short)(pGemItem.incMAD * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incMDD > 0) { pNewItemEquip.niMDD += (short)(pGemItem.incMDD * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incSTR > 0) { pNewItemEquip.niSTR += (short)(pGemItem.incSTR * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incINT > 0) { pNewItemEquip.niINT += (short)(pGemItem.incINT * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incDEX > 0) { pNewItemEquip.niDEX += (short)(pGemItem.incDEX * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incLUK > 0) { pNewItemEquip.niLUK += (short)(pGemItem.incLUK * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incACC > 0) { pNewItemEquip.niACC += (short)(pGemItem.incACC * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incEVA > 0) { pNewItemEquip.niEVA += (short)(pGemItem.incEVA * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incMaxHP > 0) { pNewItemEquip.niMaxHP += (short)(pGemItem.incMaxHP * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incMaxMP > 0) { pNewItemEquip.niMaxMP += (short)(pGemItem.incMaxMP * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incJump > 0) { pNewItemEquip.niJump += (short)(pGemItem.incJump * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incSpeed > 0) { pNewItemEquip.niSpeed += (short)(pGemItem.incSpeed * (bStimulantUsed ? 2 : 1)); } else if (pGemItem.incReqLevel < 0) { pNewItemEquip.nLevel = (byte)(pNewItemEquip.nLevel + (pGemItem.incReqLevel * (bStimulantUsed ? 2 : 1))); } else if (pGemItem.RandOption > 0) { var gX = new GaussianRandom(); var nRange = pGemItem.RandOption * (bStimulantUsed ? 2 : 1); if (pNewItemEquip.niMaxHP > 0) { pNewItemEquip.niMaxHP = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niMaxHP, nRange, false)); } if (pNewItemEquip.niMaxMP > 0) { pNewItemEquip.niMaxMP = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niMaxMP, nRange, false)); } if (pNewItemEquip.niPAD > 0) { pNewItemEquip.niPAD = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niPAD, nRange, false)); } if (pNewItemEquip.niMAD > 0) { pNewItemEquip.niMAD = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niMAD, nRange, false)); } if (pNewItemEquip.niPDD > 0) { pNewItemEquip.niPDD = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niPDD, nRange, false)); } if (pNewItemEquip.niMDD > 0) { pNewItemEquip.niMDD = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niMDD, nRange, false)); } if (pNewItemEquip.niSpeed > 0) { pNewItemEquip.niSpeed = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niSpeed, nRange, false)); } if (pNewItemEquip.niJump > 0) { pNewItemEquip.niJump = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niJump, nRange, false)); } } // pNewItemEquip.ApplyRandStatOption(pGemItem.RandOption * (bStimulantUsed ? 2 : 1), false); else if (pGemItem.RandStat > 0) { var gX = new GaussianRandom(); var nRange = pGemItem.RandStat * (bStimulantUsed ? 2 : 1); if (pNewItemEquip.niSTR > 0) { pNewItemEquip.niSTR = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niSTR, nRange, false)); } if (pNewItemEquip.niLUK > 0) { pNewItemEquip.niLUK = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niLUK, nRange, false)); } if (pNewItemEquip.niINT > 0) { pNewItemEquip.niINT = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niINT, nRange, false)); } if (pNewItemEquip.niDEX > 0) { pNewItemEquip.niDEX = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niDEX, nRange, false)); } if (pNewItemEquip.niACC > 0) { pNewItemEquip.niACC = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niACC, nRange, false)); } if (pNewItemEquip.niEVA > 0) { pNewItemEquip.niEVA = (short)Math.Max(0, gX.GaussianDistributionVariation(pNewItemEquip.niEVA, nRange, false)); } } } } InventoryManipulator.InsertInto(pChar, pNewItemEquip); } else { pNewItemRaw.nNumber = (short)makerItem.ItemNum; InventoryManipulator.InsertInto(pChar, pNewItemRaw); } // remove gems if any foreach (var nGemItemId in aGemItemIds) { InventoryManipulator.RemoveQuantity(pChar, nGemItemId, 1); //InventoryManipulator.RemoveFrom(pChar, (byte)InventoryType.Etc, itemSlot, 1); } foreach (var entry in makerItem.RandomReward) { if (Constants.Rand.Next(100) >= entry.Prob) { continue; } var pRandRewardItem = MasterManager.CreateItem(entry.ItemID); pRandRewardItem.nNumber = (short)entry.ItemNum; InventoryManipulator.InsertInto(pChar, pRandRewardItem); } // END MAKER ITEM CREATION } // END RECIPE PROCESSING // SEND RESPONSE PACKETS pChar.SendPacket(CreateItemResponse(bSuccess, bStimulantUsed, makerItem, aGemItemIds)); pChar.SendPacket(MakerItemEffectLocal(bSuccess)); pChar.Field.Broadcast(MakerItemEffectRemote(pChar.dwId, bSuccess)); }
public void GaussianDistributionTest() { try { if (Chart == null) return; try { Chart.Primitives.Clear(); var rand = new GaussianRandom(); float minY = float.MaxValue; float maxY = float.MinValue; var values = new float[100000]; for (int x = 0; x < values.Length; x++) { float val = rand.NextGaussian(0, 1); values[x] = val; if (val > maxY) maxY = val; if (val < minY) minY = val; } const int distributionSteps = 1000; float stepSizeY = (maxY - minY)/distributionSteps; var distributionBucketCount = new Point[distributionSteps]; // Set X-positions for all points for (int i = 0; i < distributionBucketCount.Length; i++) distributionBucketCount[i].X = MyMathHelper.Lerp(i, 0, distributionBucketCount.Length, 0, values.Length); // Increase Y-position by one for each bucket hit foreach (float valY in values) { int bucketIndex = Convert.ToUInt16(Math.Min(distributionSteps - 1, (valY - minY)/stepSizeY)); distributionBucketCount[bucketIndex].Y++; } SwordfishGraphHelper.AddLineXY(Chart, "Gaussian values", Colors.Gray, values); SwordfishGraphHelper.AddLineXY(Chart, "Distribution bucket count", Colors.Red, distributionBucketCount); Chart.Title = "GaussianDistributionTest()"; Chart.XAxisLabel = "X Axis"; Chart.YAxisLabel = "Y Axis"; Chart.RedrawPlotLines(); } catch (Exception e) { MessageBox.Show(e.ToString()); Console.WriteLine(e); } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public GPSFilter2D(GPSObservation startState) { X0 = Matrix.Create(new double[n, 1] { { startState.Position.X }, { startState.Position.Y }, { startState.Position.Z }, // Position { 0 }, { 0 }, { 0 }, // Velocity { 0 }, { 0 }, { 0 }, // Acceleration }); PostX0 = X0.Clone(); /* Matrix.Create(new double[n, 1] * { * {startState.Position.X}, {startState.Position.Y}, {startState.Position.Z}, // Position * {1}, {0}, {0}, // Velocity * {0}, {1}, {0}, // Acceleration * });*/ // Start by assuming no covariance between states, meaning position, velocity, acceleration and their three XYZ components // have no correlation and behave independently. This not entirely true. PostP0 = Matrix.Identity(n, n); // Refs: // http://www.romdas.com/technical/gps/gps-acc.htm // http://www.sparkfun.com/datasheets/GPS/FV-M8_Spec.pdf // http://onlinestatbook.com/java/normalshade.html // Assuming GPS Sensor: FV-M8 // Cold start: 41s // Hot start: 1s // Position precision: 3.3m CEP (horizontal circle, half the points within this radius centred on truth) // Position precision (DGPS): 2.6m CEP // const float coVarQ = ; // _r = covarianceR; // Determine standard deviation of estimated process and observation noise variance // Position process noise _stdDevW = Vector.Zeros(n); //(float)Math.Sqrt(_q); _rand = new GaussianRandom(); // Circle Error Probable (50% of the values are within this radius) // const float cep = 3.3f; // GPS position observation noise by standard deviation [meters] // Assume gaussian distribution, 2.45 x CEP is approx. 2dRMS (95%) // ref: http://www.gmat.unsw.edu.au/snap/gps/gps_survey/chap2/243.htm // Found empirically by http://onlinestatbook.com/java/normalshade.html // using area=0.5 and limits +- 3.3 meters _stdDevV = new Vector(new double[m] { 0, ObservationNoiseStdDevY, 0, // 0, // 0, // 0, // 0, // 0, // 0, // 0, }); //Vector.Zeros(Observations); //2, 2, 4.8926f); H = Matrix.Identity(m, n); I = Matrix.Identity(n, n); Q = new Matrix(n, n); R = Matrix.Identity(m, m); _prevEstimate = GetInitialEstimate(X0, PostX0, PostP0); }
public GPSFilter2D(GPSObservation startState) { X0 = Matrix.Create(new double[n,1] { {startState.Position.X}, {startState.Position.Y}, {startState.Position.Z}, // Position {0}, {0}, {0}, // Velocity {0}, {0}, {0}, // Acceleration }); PostX0 = X0.Clone(); /* Matrix.Create(new double[n, 1] { {startState.Position.X}, {startState.Position.Y}, {startState.Position.Z}, // Position {1}, {0}, {0}, // Velocity {0}, {1}, {0}, // Acceleration });*/ // Start by assuming no covariance between states, meaning position, velocity, acceleration and their three XYZ components // have no correlation and behave independently. This not entirely true. PostP0 = Matrix.Identity(n, n); // Refs: // http://www.romdas.com/technical/gps/gps-acc.htm // http://www.sparkfun.com/datasheets/GPS/FV-M8_Spec.pdf // http://onlinestatbook.com/java/normalshade.html // Assuming GPS Sensor: FV-M8 // Cold start: 41s // Hot start: 1s // Position precision: 3.3m CEP (horizontal circle, half the points within this radius centred on truth) // Position precision (DGPS): 2.6m CEP // const float coVarQ = ; // _r = covarianceR; // Determine standard deviation of estimated process and observation noise variance // Position process noise _stdDevW = Vector.Zeros(n); //(float)Math.Sqrt(_q); _rand = new GaussianRandom(); // Circle Error Probable (50% of the values are within this radius) // const float cep = 3.3f; // GPS position observation noise by standard deviation [meters] // Assume gaussian distribution, 2.45 x CEP is approx. 2dRMS (95%) // ref: http://www.gmat.unsw.edu.au/snap/gps/gps_survey/chap2/243.htm // Found empirically by http://onlinestatbook.com/java/normalshade.html // using area=0.5 and limits +- 3.3 meters _stdDevV = new Vector(new double[m] { 0, ObservationNoiseStdDevY, 0, // 0, // 0, // 0, // 0, // 0, // 0, // 0, }); //Vector.Zeros(Observations); //2, 2, 4.8926f); H = Matrix.Identity(m, n); I = Matrix.Identity(n, n); Q = new Matrix(n, n); R = Matrix.Identity(m, m); _prevEstimate = GetInitialEstimate(X0, PostX0, PostP0); }
public void UseUpgradeScroll(short nScrollPOS, short nEquipPOS, bool bWhiteScroll) { if (Parent.Stats.nHP <= 0) { return; } var pScrollTemplate = InventoryManipulator.GetItem(Parent, InventoryType.Consume, nScrollPOS).Template as ConsumeItemTemplate; var pEquip = InventoryManipulator.GetItem(Parent, InventoryType.Equip, nEquipPOS) as GW_ItemSlotEquip; var nWhiteScrollPOS = InventoryManipulator.GetAnyItem(Parent, InventoryType.Consume, ItemConstants.WhiteScroll).Item1; if (pEquip == null || pScrollTemplate == null) { return; } if (pEquip.CashItem) { return; } if (pEquip.RemainingUpgradeCount <= 0 && pScrollTemplate.Recover <= 0) { return; } var bSuccess = pScrollTemplate.ScrollSuccess(Constants.Rand); var bDestroy = !bSuccess && pScrollTemplate.ScrollDestroy(Constants.Rand); bWhiteScroll = bWhiteScroll && nWhiteScrollPOS > 0; if (!ItemConstants.is_correct_upgrade_equip(pScrollTemplate.TemplateId, pEquip.nItemID)) // PE, validated client-side { return; } if (bSuccess) { if (pScrollTemplate.Recover > 0) { pEquip.RemainingUpgradeCount += (byte)pScrollTemplate.Recover; } else { if (pScrollTemplate.PreventSlip) { pEquip.nAttribute |= ItemAttributeFlags.Spikes; } else if (pScrollTemplate.WarmSupport) { pEquip.nAttribute |= ItemAttributeFlags.Cold; } else if (pScrollTemplate.RandStat) { var randRange = 2 + (2 * pScrollTemplate.IncRandVol); var gX = new GaussianRandom(); if (pEquip.niSTR > 0) { pEquip.niSTR = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niSTR, randRange, false)); } if (pEquip.niLUK > 0) { pEquip.niLUK = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niLUK, randRange, false)); } if (pEquip.niINT > 0) { pEquip.niINT = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niINT, randRange, false)); } if (pEquip.niDEX > 0) { pEquip.niDEX = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niDEX, randRange, false)); } if (pEquip.niACC > 0) { pEquip.niACC = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niACC, randRange, false)); } if (pEquip.niEVA > 0) { pEquip.niEVA = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niEVA, randRange, false)); } if (pEquip.niMaxHP > 0) { pEquip.niMaxHP = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niMaxHP, randRange, false)); } if (pEquip.niMaxMP > 0) { pEquip.niMaxMP = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niMaxMP, randRange, false)); } if (pEquip.niPAD > 0) { pEquip.niPAD = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niPAD, randRange, false)); } if (pEquip.niMAD > 0) { pEquip.niMAD = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niMAD, randRange, false)); } if (pEquip.niPDD > 0) { pEquip.niPDD = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niPDD, randRange, false)); } if (pEquip.niMDD > 0) { pEquip.niMDD = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niMDD, randRange, false)); } if (pEquip.niSpeed > 0) { pEquip.niSpeed = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niSpeed, randRange, false)); } if (pEquip.niJump > 0) { pEquip.niJump = (short)Math.Max(0, gX.GaussianDistributionVariation(pEquip.niJump, randRange, false)); } } else { pEquip.niSTR += (short)pScrollTemplate.IncSTR; pEquip.niLUK += (short)pScrollTemplate.IncLUK; pEquip.niINT += (short)pScrollTemplate.IncINT; pEquip.niDEX += (short)pScrollTemplate.IncDEX; pEquip.niMaxHP += (short)pScrollTemplate.IncMHP; pEquip.niMaxMP += (short)pScrollTemplate.IncMMP; pEquip.niPAD += (short)pScrollTemplate.IncPAD; // watk pEquip.niMAD += (short)pScrollTemplate.IncMAD; // matk pEquip.niPDD += (short)pScrollTemplate.IncPDD; // wdef pEquip.niMDD += (short)pScrollTemplate.IncMDD; // mdef pEquip.niACC += (short)pScrollTemplate.IncACC; // accuracy pEquip.niEVA += (short)pScrollTemplate.IncEVA; // avoid pEquip.niCraft += (short)pScrollTemplate.IncCraft; // still not sure wtf this is pEquip.niSpeed += (short)pScrollTemplate.IncSpeed; pEquip.niJump += (short)pScrollTemplate.IncJump; } } } if (bDestroy) { InventoryManipulator.RemoveFrom(Parent, InventoryType.Equip, nEquipPOS); } else // success or fail { if (pScrollTemplate.Recover <= 0) // not an upgrade count recovery scroll { pEquip.RemainingUpgradeCount -= 1; // reduce remaining upgrade count if no white scroll if (bSuccess) { pEquip.CurrentUpgradeCount += 1; // increase upgrade count } else if (bWhiteScroll) { pEquip.RemainingUpgradeCount += 1; } if (bWhiteScroll) { InventoryManipulator.RemoveFrom(Parent, InventoryType.Consume, nWhiteScrollPOS); } } Parent.Modify.Inventory(ctx => { ctx.UpdateEquipInformation(pEquip, nEquipPOS); }); } InventoryManipulator.RemoveFrom(Parent, InventoryType.Consume, nScrollPOS); Parent.StatisticsTracker.IncrementScrollUse(pScrollTemplate.TemplateId, bSuccess, bDestroy); Parent.Field.Broadcast(pEquip.ShowItemUpgradeEffect(Parent, bSuccess, bDestroy, bWhiteScroll)); }
void CreateMidMeshes() { stockmidList = MarketDataParser.LoadStocksMid(); int maxSamples = stockmidList.Count; float x1 = stockmidList[0][0]; float y1 = stockmidList[0][1]; float x2 = stockmidList[1][0]; float y2 = stockmidList[1][1]; particles = new Particle[maxSamples]; for (int i = 0; i < particles.Length; i++) { particles[i].size = defaultParticleSize; particles[i].color = defaultParticleColor; } int stocksToRender = System.Math.Min(stockmidList[0].Count, maxNShow); print("stockCount=" + stocksToRender + ", cubersPerMesh=" + cubesPerMesh); int NMeshes = 100; goMeshes = new GameObject[NMeshes]; // maxSamples//[stocksToRender]; meshes = new Mesh[NMeshes]; // stocksToRender]; GaussianRandom gaussianRandom = new GaussianRandom(); List <Color> mesh_colors = new List <Color> { Color.red, Color.green, Color.blue, Color.yellow }; int color_choices = mesh_colors.Count; Counts = new int[stocksToRender]; for (int t = 0; t < cubesPerMesh && t < maxSamples; t++) { // GameObject go = new GameObject("Mesh " + t); go.transform.parent = transform; MeshFilter mf = go.AddComponent <MeshFilter>(); Mesh mesh = new Mesh(); mesh.MarkDynamic(); mf.mesh = mesh; Renderer rend = go.AddComponent <MeshRenderer>(); rend.material = material; rend.material.color = mesh_colors[t % color_choices]; var vertices = new Vector3[24 * cubesPerMesh]; var triangles = new int[36 * cubesPerMesh]; var normals = new Vector3[24 * cubesPerMesh]; var colors = new Color[24 * cubesPerMesh]; int vertex_group = 10 * 24; for (int c = 0; c < colors.Length / vertex_group; ++c) { var a_color = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); for (int k = 0; k < vertex_group; ++k) { colors[vertex_group * c + k] = a_color; } } var uv = new Vector2[24 * cubesPerMesh]; float x_time = 0, y_return = 0; // TODO: cubesPerMesh might be smaller than the sample count //for (int t = 0; t < cubesPerMesh && t < maxSamples; t++) { for (int iStock = 0; iStock < stocksToRender; iStock++) { // x=> screen x // y=> screen y // z=> depth //x = (float)(gaussianRandom.NextGaussian() * spaceRange); //z = (float)(gaussianRandom.NextGaussian() * spaceRange); //y = (float)(0.1*x + 0.2*z + gaussianRandom.NextGaussian() * 0.5 * spaceRange ); x_time += spaceRange; print("Adding x_time=" + x_time + ", y_price=" + y_return + ", z_stock" + iStock); MeshCube.AddCube(ref vertices, ref triangles, ref normals, ref uv, t, new Vector3(x_time, 0, iStock * spaceRange * 10), defaultParticleSize / 2); } mesh.vertices = vertices; mesh.triangles = triangles; mesh.normals = normals; mesh.colors = colors; mesh.uv = uv; mesh.RecalculateBounds(); mesh.Optimize(); for (int k = 0; k < 5; k++) { print("k=" + k); print("vertices: " + mesh.vertices[k]); print("triangles: " + mesh.triangles[k]); print("normals: " + mesh.normals[k]); print("uv: " + mesh.uv[k]); print("colors: " + mesh.colors[k]); } goMeshes[t] = go; meshes[t] = mesh; } print("Meshes created"); }
public GPSINSFilter(TimeSpan startTime, Vector3 startPos, Vector3 startVelocity, Quaternion orientation, SensorSpecifications sensorSpecifications) { _startTime = startTime; _orientation = orientation; _sensorSpecifications = sensorSpecifications; X0 = Matrix.Create(new double[n,1] { {startPos.X}, {startPos.Y}, {startPos.Z}, // Position {startVelocity.X}, {startVelocity.Y}, {startVelocity.Z}, // Velocity {_orientation.X}, {_orientation.Y}, {_orientation.Z}, {_orientation.W}, // Quaternion }); // Make sure we don't reference the same object, but rather copy its values. // It is possible to set PostX0 to a different state than X0, so that the initial guess // of state is wrong. PostX0 = X0.Clone(); // We use a very low initial estimate for error covariance, meaning the filter will // initially trust the model more and the sensors/observations less and gradually adjust on the way. // Note setting this to zero matrix will cause the filter to infinitely distrust all observations, // so always use a close-to-zero value instead. // Setting it to a diagnoal matrix of high values will cause the filter to trust the observations more in the beginning, // since we say that we think the current PostX0 estimate is unreliable. PostP0 = 0.001*Matrix.Identity(n, n); // Determine standard deviation of estimated process and observation noise variance // Process noise (acceleromters, gyros, etc..) _stdDevW = new Vector(new double[n] { _sensorSpecifications.AccelerometerStdDev.Forward, _sensorSpecifications.AccelerometerStdDev.Right, _sensorSpecifications.AccelerometerStdDev.Up, 0, 0, 0, 0, 0, 0, 0 }); // Observation noise (GPS inaccuarcy etc..) _stdDevV = new Vector(new double[m] { _sensorSpecifications.GPSPositionStdDev.X, _sensorSpecifications.GPSPositionStdDev.Y, _sensorSpecifications.GPSPositionStdDev.Z, // 0.001000, 0.001000, 0.001000, // 1000, 1000, 1000, _sensorSpecifications.GPSVelocityStdDev.X, _sensorSpecifications.GPSVelocityStdDev.Y, _sensorSpecifications.GPSVelocityStdDev.Z, }); I = Matrix.Identity(n, n); _zeroMM = Matrix.Zeros(m); _rand = new GaussianRandom(); _prevEstimate = GetInitialEstimate(X0, PostX0, PostP0); }
private void Initialize() { gaussianRandom = new GaussianRandom(rnd); phasePoints = new ObservableCollection<DataPoint>(); currentPhasePoints = new ObservableCollection<DataPoint>(); positionPoints = new ObservableCollection<DataPoint>(); velocityPoints = new ObservableCollection<DataPoint>(); accelerationPoints = new ObservableCollection<DataPoint>(); animationSpeed = 0; epsilon0 = 0.05; alpha = StartAlpha; omega = 2; r = 80; lCurrent = l = 300; rimBlockDistance = Math.Sqrt(L * L - R * R); rimCenter = new Point(CanvasHalfWidth - rimBlockDistance * 2 / 3, CanvasHalfHeight); currentX = rimBlockDistance; currentV = 0.0; currentA = 0.0; lastTime = 0.0; deltaTime = 0; dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimerTick; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); buttonsFlags = new bool[3] { false, false, false }; }
public static int GaussianRandomRange(int min, int max) { return(GaussianRandom.Range(min, max)); }
// Use this for initialization void Start () { GaussianRandom gr = new GaussianRandom(); double randomNumber = gr.NextDouble(); Debug.Log("Gaussian Random Number = " + randomNumber); }
void CreateStockListMeshes() { stockLists = MarketDataParser.LoadStocks(); int maxSamples = 0; foreach (var list in stockLists) { if (maxSamples < list.Count) { maxSamples = list.Count; } } particles = new Particle[maxSamples]; for (int i = 0; i < particles.Length; i++) { particles[i].size = defaultParticleSize; particles[i].color = defaultParticleColor; } int stocksToRender = stockLists.Count; print("stockCount=" + stockLists.Count + ", cubersPerMesh=" + cubesPerMesh); goMeshes = new GameObject[stockLists.Count]; meshes = new Mesh[stockLists.Count]; GaussianRandom gaussianRandom = new GaussianRandom(); List <Color> mesh_colors = new List <Color> { Color.red, Color.green, Color.blue, Color.yellow }; int color_choices = mesh_colors.Count; Counts = new int[stockLists.Count]; for (int i = 0; i < stockLists.Count; i++) { GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube); //new GameObject("Mesh " + i); go.transform.parent = transform; MeshFilter mf = go.AddComponent <MeshFilter>(); Mesh mesh = new Mesh(); mesh.MarkDynamic(); mf.mesh = mesh; Renderer rend = go.AddComponent <MeshRenderer>(); rend.material = material; rend.material.color = mesh_colors[i % color_choices]; var vertices = new Vector3[24 * cubesPerMesh]; var triangles = new int[36 * cubesPerMesh]; var normals = new Vector3[24 * cubesPerMesh]; var colors = new Color[24 * cubesPerMesh]; int vertex_group = 10 * 24; var uv = new Vector2[24 * cubesPerMesh]; for (int c = 0; c < colors.Length / vertex_group; ++c) { var a_color = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)); for (int k = 0; k < vertex_group; ++k) { colors[vertex_group * c + k] = a_color; } } float x_time = 0, y_return = 0; // TODO: cubesPerMesh might be smaller than the sample count var samples = stockLists[i]; Counts[i] = samples.Count; for (int j = 0; j < cubesPerMesh && j < samples.Count; j++) { // x=> screen x // y=> screen y // z=> depth //x = (float)(gaussianRandom.NextGaussian() * spaceRange); //z = (float)(gaussianRandom.NextGaussian() * spaceRange); //y = (float)(0.1*x + 0.2*z + gaussianRandom.NextGaussian() * 0.5 * spaceRange ); x_time += spaceRange; float init = samples[0].open; float open = samples[j].open; y_return = (open - init) * 10000 / init; // in bps print("Adding x_time=" + x_time + ", y_price=" + y_return + ", z_stock" + i); MeshCube.AddCube(ref vertices, ref triangles, ref normals, ref uv, j, new Vector3(x_time, 0, i * spaceRange * 10), defaultParticleSize / 2); } mesh.vertices = vertices; mesh.triangles = triangles; mesh.normals = normals; mesh.colors = colors; mesh.uv = uv; mesh.RecalculateBounds(); mesh.Optimize(); for (int k = 0; k < 5; k++) { print("k=" + k); print("vertices: " + mesh.vertices[k]); print("triangles: " + mesh.triangles[k]); print("normals: " + mesh.normals[k]); print("uv: " + mesh.uv[k]); print("colors: " + mesh.colors[k]); } goMeshes[i] = go; meshes[i] = mesh; } print("Meshes created"); }