public override Application setup(OcTree target) { Vector3 halfDimension = worldDimensions / target.voxelSize() /2f; Vector3 center = target.transform.InverseTransformPoint(worldPosition) / target.voxelSize(); Vector3 exactMin = center - halfDimension; Vector3 exactMax = center + halfDimension; CubeApp app = new CubeApp(); app.tree = target; app.halfDimension = halfDimension; app.min = new Index(target.maximumDetail, (uint)exactMin.x, (uint)exactMin.y, (uint)exactMin.z); app.max = new Index(target.maximumDetail, (uint)exactMax.x, (uint)exactMax.y, (uint)exactMax.z); app.position = center; return app; }
public override Application setup(OcTree target) { float radius = worldRadius / target.voxelSize(); Vector3 radiusCube = new Vector3(radius, radius, radius); Vector3 center = target.globalToVoxelPosition(worldPosition); Vector3 exactMin = center - radiusCube; Vector3 exactMax = center + radiusCube; SphereApp app = new SphereApp(); app.tree = target; app.min = new Index(target.maximumDetail, (uint)exactMin.x, (uint)exactMin.y, (uint)exactMin.z); app.max = new Index(target.maximumDetail, (uint)exactMax.x, (uint)exactMax.y, (uint)exactMax.z); app.position = center; app.radius = radius; return app; }