public NativeArray <DetectionData> _WorldFrame; // Detection data를 저장하기 위한 변수 public void Execute(int i) { if (_isSaveIntensity) { if (_RaycastHit[i].distance != 0) { _cosineIncidence = _RaycastHit[i].normal.x * _RaycastCommand[i].direction.x + _RaycastHit[i].normal.y * _RaycastCommand[i].direction.y + _RaycastHit[i].normal.z * _RaycastCommand[i].direction.z; } } else { _cosineIncidence = 0f; } _LidarFrame[i] = new DetectionData(_frame, _time, new Vector3(_RaycastHit[i].distance, _RayAngles[i].x, _RayAngles[i].y), _cosineIncidence); _WorldFrame[i] = new DetectionData(_frame, _time, _RaycastHit[i].point, _cosineIncidence); }
void SaveIntensity() { int i = 0; float reflectivity; float cosIncidence; float intensity; foreach (RaycastHit hit in m_Result) { if (hit.distance != 0) { reflectivity = GetReflectivity(hit); cosIncidence = m_WorldDetectionData[i].Intensity; // Calculate cosIncidence in jobsystem if (m_isPreciseRadiometricModel) { intensity = reflectivity * Math.Abs(cosIncidence) * (float)ComputeIntensity(hit.distance, i); } else { intensity = reflectivity * Math.Abs(cosIncidence) / hit.distance / hit.distance; } if (intensity < 0 || intensity > 255) { intensity = 0; } // Save DetectionDate with calculated Intensity m_LidarDetectionData[i] = new DetectionData(frame, m_LidarDetectionData[i].Timestamp, m_LidarDetectionData[i].Position, intensity); m_WorldDetectionData[i] = new DetectionData(frame, m_WorldDetectionData[i].Timestamp, m_WorldDetectionData[i].Position, intensity); } else { m_LidarDetectionData[i] = new DetectionData(frame, m_LidarDetectionData[i].Timestamp, m_LidarDetectionData[i].Position, 0); m_WorldDetectionData[i] = new DetectionData(frame, m_WorldDetectionData[i].Timestamp, m_WorldDetectionData[i].Position, 0); } i++; } }