/** * Retrieve the current probe configuration. * @return The UltrasoundProbeConfiguration of the probe GameObject. */ public UltrasoundProbeConfiguration GetProbeConfig() { UltrasoundProbeConfiguration config = new UltrasoundProbeConfiguration(this.transform); config.SetMaxScanDistance(this.MaxDistance); config.SetMinScanDistance(this.MinDistance); config.SetArcSizeInDegrees(this.ArcSizeInDegrees); config.SetNumberOfScanlines(this.NumberOfScanlines); config.SetPointsPerScanline(this.PointsPerScanline); return(config); }
public UltrasoundScanData SendScanData() { UltrasoundProbeConfiguration config = new UltrasoundProbeConfiguration(); config.SetMaxScanDistance(MAX_Y); config.SetMinScanDistance(MIN_Y); UltrasoundScanData data = new UltrasoundScanData(config); for (float i = MIN_X; i <= MAX_X; i += STEPSIZE) { UltrasoundScanline scanline = new UltrasoundScanline(config.GetPosition()); for (float j = MIN_Y; j <= MAX_Y; j += STEPSIZE) { UltrasoundPoint p = new UltrasoundPoint(Vector3.zero, new Vector2(i * (j / MAX_Y), j)); p.SetBrightness(Random.Range(0f, 1f)); // Generate noise. scanline.AddUltrasoundPoint(p); } data.AddScanline(scanline); } return(data); }