*
This commit is contained in:
@@ -0,0 +1,330 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using JetBrains.Annotations;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
public class BlackHoleRenderer : MonoBehaviour {
|
||||
void Start() {
|
||||
|
||||
}
|
||||
|
||||
struct Ray
|
||||
{
|
||||
public SphericalDir Dir;
|
||||
public SphericalCoord P; //Canonical momenta
|
||||
public double b;
|
||||
public double q;
|
||||
|
||||
public Double3 DirectionOfMotionInCameraCortesianSpace(Double3 N, double beta) { //F
|
||||
double betaSquare = beta * beta;
|
||||
double nfy = (-N.Y + beta) / (1.0 - (beta * N.Y));
|
||||
double nfx = (-Math.Sqrt(1.0 - betaSquare) * N.X) / (1.0 - beta * N.Y);
|
||||
double nfz = (-Math.Sqrt(1.0 - betaSquare) * N.Z) / (1.0 - beta * N.Y);
|
||||
return new Double3 { X = nfx, Y = nfy, Z = nfz };
|
||||
}
|
||||
|
||||
public SphericalCoord FSpherical(SphericalCoord B, Double3 nF) {
|
||||
double kappa = Math.Sqrt(B.R * B.R + B.Dir.Phi * B.Dir.Phi);
|
||||
|
||||
double nFr = ((B.Dir.Phi / kappa) * nF.X) + (B.R * nF.Y) + ((B.R * B.Dir.Theta) / kappa) * nF.Z;
|
||||
double nFTheta = B.Dir.Theta * nF.Y - kappa * nF.Z;
|
||||
double nFPhi = (-B.R / kappa) * nF.X + B.Dir.Phi * nF.Y + ((B.Dir.Phi * B.Dir.Theta) / kappa) * nF.Z;
|
||||
|
||||
SphericalCoord result;
|
||||
result.R = nFr;
|
||||
result.Dir.Theta = nFTheta;
|
||||
result.Dir.Phi = nFPhi;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void CanonicalMomenta(FidoCamera camera, KerrMetric metric) { //p
|
||||
var N = Dir.ToCartesian();
|
||||
var Fdir = DirectionOfMotionInCameraCortesianSpace(N, camera.Beta);
|
||||
var F = FSpherical(camera.Speed, Fdir);
|
||||
|
||||
double Ef = 1.0 / (metric.Alpha + metric.Omega * metric.OmegaUpLine * F.Dir.Phi);
|
||||
|
||||
double pr = Ef * (metric.Rho / Math.Sqrt(metric.Delta)) * F.R;
|
||||
double pTheta = Ef * metric.Rho * F.Dir.Theta;
|
||||
double pPhi = Ef * metric.OmegaUpLine * F.Dir.Phi;
|
||||
|
||||
SphericalCoord result;
|
||||
result.R = pr;
|
||||
result.Dir.Phi = pPhi;
|
||||
result.Dir.Theta = pTheta;
|
||||
|
||||
P = result;
|
||||
|
||||
}
|
||||
|
||||
public void Update(FidoCamera camera, KerrMetric metric)
|
||||
{
|
||||
CanonicalMomenta(camera, metric);
|
||||
|
||||
b = P.Dir.Phi;
|
||||
double cosTheta = Math.Cos(Dir.Theta);
|
||||
double sinTheta = Math.Sin(Dir.Theta);
|
||||
q = P.Dir.Theta * P.Dir.Theta +
|
||||
cosTheta * cosTheta * (((b * b) / (sinTheta * sinTheta)) - metric.A * metric.A);
|
||||
}
|
||||
}
|
||||
|
||||
double betaZero(double r_zero, BlackHole hole)
|
||||
{
|
||||
double r_zero_square = r_zero * r_zero;
|
||||
double r_zero_cube = r_zero_square * r_zero;
|
||||
|
||||
double a_square = hole.A * hole.A;
|
||||
return -((r_zero_cube - 3 * r_zero_square + a_square * r_zero + a_square) / (hole.A * (r_zero - 1.0)));
|
||||
}
|
||||
|
||||
double qZero(double r, BlackHole hole) {
|
||||
double rSquare = r * r;
|
||||
double rCube = rSquare * r;
|
||||
double aSquare = hole.A * hole.A;
|
||||
double rm1 = r - 1;
|
||||
double rmSquare = rm1 * rm1;
|
||||
return -(rCube * (rCube - 6 * rSquare + 9 * r - 4 * aSquare)) / (aSquare * rmSquare);
|
||||
}
|
||||
|
||||
double rZero_0(double b, double a) { //my
|
||||
var aSquare = a * a;
|
||||
var subExpr0 = 3 * aSquare + 3 * a * b - 9;
|
||||
var subExpr2 = (54 - 54 * aSquare);
|
||||
|
||||
var cubeRootOf2 = Math.Pow(2.0, 1.0 / 3.0);
|
||||
var subExpr1 = Math.Pow(Math.Sqrt(Math.Abs(4 * subExpr0 * subExpr0 * subExpr0 + subExpr2 * subExpr2)) + subExpr2, 1.0 / 3.0);
|
||||
|
||||
return -(cubeRootOf2 * subExpr0) / (3.0 * subExpr1) + (subExpr1 / (3.0 * cubeRootOf2)) + 1;
|
||||
}
|
||||
|
||||
double rZero_1(double b, double a) { //my
|
||||
var aSquare = a * a;
|
||||
var subExpr0 = 3 * aSquare + 3 * a * b - 9;
|
||||
var subExpr2 = (54 - 54 * aSquare);
|
||||
|
||||
var cubeRootOf2 = Math.Pow(2.0, 1.0 / 3.0);
|
||||
|
||||
var subExpr1 = Math.Pow(Math.Sqrt(Math.Abs(4 * subExpr0 * subExpr0 * subExpr0 + subExpr2 * subExpr2)) + subExpr2, 1.0 / 3.0);
|
||||
return ((1 + Math.Sqrt(3.0)) * subExpr0) / (3.0 * Math.Pow(2.0, 2.0/3.0) * subExpr1) - (( (1 - Math.Sqrt(3)) * subExpr1) / (6.0 * cubeRootOf2)) + 1;
|
||||
}
|
||||
|
||||
double rZero_2(double b, double a) { //my
|
||||
var aSquare = a * a;
|
||||
var subExpr0 = 3 * aSquare + 3 * a * b - 9;
|
||||
var subExpr2 = (54 - 54 * aSquare);
|
||||
|
||||
var cubeRootOf2 = Math.Pow(2.0, 1.0 / 3.0);
|
||||
|
||||
var subExpr1 = Math.Pow(Math.Sqrt(Math.Abs(4 * subExpr0 * subExpr0 * subExpr0 + subExpr2 * subExpr2)) + subExpr2, 1.0 / 3.0);
|
||||
return ((1 - Math.Sqrt(3.0)) * subExpr0) / (3.0 * Math.Pow(2.0, 2.0 / 3.0) * subExpr1) - (((1 + Math.Sqrt(3)) * subExpr1) / (6.0 * cubeRootOf2)) + 1;
|
||||
}
|
||||
|
||||
|
||||
[Serializable]
|
||||
public class FidoCamera
|
||||
{
|
||||
public SphericalCoord Position;
|
||||
public SphericalCoord Speed;
|
||||
public double Beta;
|
||||
|
||||
public void UpdateMetricAndSelf(KerrMetric metric, BlackHole hole)
|
||||
{
|
||||
metric.Update(hole.A, Position.R, Position.Dir.Theta);
|
||||
double bigOmega = 1.0 / (metric.A + Math.Pow(Position.R, 3.0 / 2.0));
|
||||
Beta = (metric.OmegaUpLine / metric.Alpha) * (bigOmega - metric.Omega);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class BlackHole
|
||||
{
|
||||
public double A;
|
||||
public double r1() {
|
||||
return 2 * (1 + Math.Cos((2.0 / 3.0) * Math.Acos(-A)));
|
||||
}
|
||||
|
||||
public double r2() {
|
||||
return 2 * (1 + Math.Cos((2.0 / 3.0) * Math.Acos(A)));
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class KerrMetric {
|
||||
public double Delta;
|
||||
public double Rho;
|
||||
public double OmegaUpLine;
|
||||
public double Omega;
|
||||
public double Sigma;
|
||||
public double Alpha;
|
||||
public double A;
|
||||
|
||||
public void Update(double a, double r, double theta) {
|
||||
double cosTheta = Math.Cos(theta);
|
||||
double sinTheta = Math.Sin(theta);
|
||||
|
||||
double cosThetaSquare = cosTheta * cosTheta;
|
||||
double sinThetaSquare = sinTheta * sinTheta;
|
||||
|
||||
double aSquare = a * a;
|
||||
double rSquare = r * r;
|
||||
|
||||
Rho = Math.Sqrt(rSquare + (aSquare * cosThetaSquare));
|
||||
Delta = rSquare - (2 * r) + aSquare;
|
||||
Sigma = Math.Sqrt((rSquare + aSquare) * (rSquare + aSquare) - aSquare * Delta * sinThetaSquare);
|
||||
Alpha = (Rho * Math.Sqrt(Delta)) / Sigma;
|
||||
Omega = (2 * a * r) / (Sigma * Sigma);
|
||||
OmegaUpLine = (Sigma * sinTheta) / Rho;
|
||||
|
||||
A = a;
|
||||
}
|
||||
}
|
||||
|
||||
public FidoCamera Camera = new FidoCamera();
|
||||
public KerrMetric Metric = new KerrMetric();
|
||||
public BlackHole Hole = new BlackHole();
|
||||
|
||||
public void RecalcState()
|
||||
{
|
||||
Camera.UpdateMetricAndSelf(Metric, Hole);
|
||||
}
|
||||
|
||||
double drdt(double delta, double rho, double Pr)
|
||||
{
|
||||
return delta / (rho * rho) * Pr;
|
||||
}
|
||||
|
||||
SphericalDir[] rays = new SphericalDir[256];
|
||||
|
||||
class BlackHoleRayIntegrator : Integrator
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DrawCameraGizmo() {
|
||||
var pos = Camera.Position.ToCartesian().ToVector3();
|
||||
|
||||
UpdateRays();
|
||||
|
||||
foreach (var rayDir in rays)
|
||||
{
|
||||
Ray ray = new Ray();
|
||||
ray.Dir = rayDir;
|
||||
ray.Update(Camera, Metric);
|
||||
|
||||
|
||||
var v0 = rZero_0(0.666, 0.9);
|
||||
var v1 = rZero_1(0.666, 0.9);
|
||||
var v2 = rZero_2(0.666, 0.9);
|
||||
// var b1 = betaZero(Hole.r2());
|
||||
// var b2 = betaZero(Hole.r1());
|
||||
|
||||
//-0.1184053483681316836 + 0.×10^-19 i
|
||||
//0.7514421233051754296 + 0.×10^-19 i
|
||||
//2.3669632250629562540 + 0.×10^-20 i
|
||||
var N = ray.Dir.ToCartesian();
|
||||
var Fdir = ray.DirectionOfMotionInCameraCortesianSpace(N, Camera.Beta);
|
||||
var F = ray.FSpherical(Camera.Speed, Fdir);
|
||||
|
||||
Gizmos.DrawLine(pos, pos + ray.P.ToCartesian().ToVector3());
|
||||
|
||||
/*
|
||||
var r0 = rZero2(b);
|
||||
var r0_ = rZero(b);
|
||||
//r0 = 2.1899962982234369;
|
||||
var q0 = qZero2(r0, b);
|
||||
|
||||
|
||||
Color rayColor = Color.white;
|
||||
if (((b1 < b) && (b < b2)) && (q < q0))
|
||||
{
|
||||
//there are no radial turning points for that {b, q}
|
||||
if (rayCanonicalMomenta_.R > 0)
|
||||
{
|
||||
//horizon
|
||||
rayColor = Color.black;
|
||||
horizon++;
|
||||
}
|
||||
else
|
||||
{
|
||||
celestial++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var a = a_spinAngularMomentumPerMass;
|
||||
|
||||
double P = Math.Sqrt(Metric.Delta * ((b - a) * (b - a) + q));
|
||||
double rUp0 = P + a * b - a * a;
|
||||
double rUp1 = -P + a * b - a * a;
|
||||
|
||||
double rUp = rUp0 > rUp1 ? rUp0 : rUp1;
|
||||
|
||||
if (cameraPosition.R > rUp)
|
||||
{
|
||||
celestial++;
|
||||
}
|
||||
else
|
||||
{
|
||||
horizon++;
|
||||
//horizon
|
||||
rayColor = Color.black;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDrawGizmos() {
|
||||
|
||||
|
||||
// double accretionDiskInnerRadius = 9.26 * M_blackHoleMass;
|
||||
// double accretionDiskOuterRadius = 18.7 * M_blackHoleMass;
|
||||
|
||||
Gizmos.DrawLine(Vector3.zero, Camera.Position.ToCartesian().ToVector3());
|
||||
Gizmos.DrawWireSphere(Vector3.zero, 1);
|
||||
|
||||
DrawCameraGizmo();
|
||||
// double OmegaBig = CameraGeodesicAngularVelocity(Rc);
|
||||
//DrawCameraGizmo(cameraCoord, cameraDirectionOfMotion);
|
||||
}
|
||||
|
||||
void UpdateRays()
|
||||
{
|
||||
int imageHeight = 16;
|
||||
int imageWidth = 16;
|
||||
|
||||
int totalRays = imageHeight * imageWidth;
|
||||
|
||||
if (rays == null || rays.Length != totalRays)
|
||||
{
|
||||
rays = new SphericalDir[totalRays];
|
||||
}
|
||||
|
||||
|
||||
double verticalFov = Math.PI / 2;
|
||||
double horizontalFov = ((double)imageWidth / imageHeight) * verticalFov;
|
||||
|
||||
for (int y = 0; y < imageHeight; y++)
|
||||
{
|
||||
double rayTheta = (Math.PI / 2) - verticalFov / 2 + (verticalFov / (imageHeight - 1) * y);
|
||||
for (int x = 0; x < imageWidth; x++)
|
||||
{
|
||||
double rayPhi = Math.PI + horizontalFov / 2 - (horizontalFov / (imageWidth - 1) * x);
|
||||
|
||||
rays[y * imageWidth + x].Phi = rayPhi;
|
||||
rays[y * imageWidth + x].Theta = rayTheta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Trace()
|
||||
{
|
||||
RecalcState();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe74eaeeaa11b4d4aa23871a3a419cf2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public struct Double3 {
|
||||
public double X;
|
||||
public double Y;
|
||||
public double Z;
|
||||
|
||||
public static Double3 operator *(Double3 v, double r) {
|
||||
return new Double3 { X = v.X * r, Y = v.Y * r, Z = v.Z * r };
|
||||
}
|
||||
|
||||
public Vector3 ToVector3() {
|
||||
return new Vector3((float)X, (float)Y, (float)Z);
|
||||
}
|
||||
|
||||
public double Length() {
|
||||
return Math.Sqrt(X * X + Y * Y + Z * Z);
|
||||
}
|
||||
public void Normalize() {
|
||||
var len = Length();
|
||||
X /= len;
|
||||
Y /= len;
|
||||
Z /= len;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct SphericalDir {
|
||||
public double Theta;
|
||||
public double Phi;
|
||||
|
||||
public Double3 ToCartesian() {
|
||||
return new Double3 { X = Math.Sin(Theta) * Math.Cos(Phi), Y = Math.Sin(Theta) * Math.Sin(Phi), Z = Math.Cos(Theta) };
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct SphericalCoord {
|
||||
public double R;
|
||||
public SphericalDir Dir;
|
||||
|
||||
public Double3 ToCartesian() {
|
||||
return Dir.ToCartesian() * R;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a42185bdea1d2e6458565cbd8df52724
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20d786d69911c9d43bb7a8dbe8ab235f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomEditor(typeof(BlackHoleRenderer))]
|
||||
public class BlackHoleRendererEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
|
||||
if (GUILayout.Button("Recalc"))
|
||||
{
|
||||
(target as BlackHoleRenderer).RecalcState();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Trace")) {
|
||||
(target as BlackHoleRenderer).Trace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beeda8413196da44c98a28d6f1c0921c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,168 @@
|
||||
// Integrator.cs
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Integrator is an abstract class for integrating a system of ODEs
|
||||
/// </summary>
|
||||
public abstract class Integrator {
|
||||
|
||||
int nEquations;
|
||||
double[] store;
|
||||
double[] k1;
|
||||
double[] k2;
|
||||
double[] k3;
|
||||
double[] k4;
|
||||
double[] ym1;
|
||||
double[] ym2;
|
||||
double[] ym3;
|
||||
double[] P;
|
||||
double[] dm1;
|
||||
double[] dm2;
|
||||
double[] dm3;
|
||||
double[] dp1;
|
||||
int abmSteps = 0;
|
||||
double abmRms2;
|
||||
|
||||
public Integrator() {
|
||||
Init(1);
|
||||
}
|
||||
|
||||
public double[] getK3() {
|
||||
return k3;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allocate memory for all storage arrays and set number of equations
|
||||
/// </summary>
|
||||
/// <param name="nEquations">N equations.</param>
|
||||
public void Init(int nEquations) {
|
||||
// set up temp arrays
|
||||
this.nEquations = nEquations;
|
||||
store = new double[nEquations];
|
||||
k1 = new double[nEquations];
|
||||
k2 = new double[nEquations];
|
||||
k3 = new double[nEquations];
|
||||
k4 = new double[nEquations];
|
||||
ym1 = new double[nEquations];
|
||||
ym2 = new double[nEquations];
|
||||
ym3 = new double[nEquations];
|
||||
P = new double[nEquations];
|
||||
dm1 = new double[nEquations];
|
||||
dm2 = new double[nEquations];
|
||||
dm3 = new double[nEquations];
|
||||
dp1 = new double[nEquations];
|
||||
abmSteps = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Abstract void, override this method to set the ODEs to be
|
||||
/// integrated.
|
||||
/// </summary>
|
||||
/// <param name="x">The values being integrated.</param>
|
||||
/// <param name="xdot">The derivatives being calculated.</param>
|
||||
public abstract void RatesOfChange(double[] x, double[] xdot, double t);
|
||||
|
||||
/// <summary>
|
||||
/// Step forward using Euler's method
|
||||
/// </summary>
|
||||
/// <param name="x">The values being integrated.</param>
|
||||
/// <param name="h">The time step.</param>
|
||||
public void EulerStep(double[] x, double t, double h) {
|
||||
RatesOfChange(x, k1, t);
|
||||
for (int i = 0; i < nEquations; i++) {
|
||||
x[i] += k1[i] * h;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Step forward using 4th order Runge Kutta method
|
||||
/// </summary>
|
||||
/// <param name="x">The values being integrated.</param>
|
||||
/// <param name="h">The time step.</param>
|
||||
public double RK4Step(double[] x, double t, double h) {
|
||||
RatesOfChange(x, k1, t);
|
||||
for (int i = 0; i < nEquations; i++) {
|
||||
store[i] = x[i] + k1[i] * h / 2.0;
|
||||
}
|
||||
RatesOfChange(store, k2, t);
|
||||
for (int i = 0; i < nEquations; i++) {
|
||||
store[i] = x[i] + k2[i] * h / 2.0;
|
||||
}
|
||||
RatesOfChange(store, k3, t);
|
||||
for (int i = 0; i < nEquations; i++) {
|
||||
store[i] = x[i] + k3[i] * h;
|
||||
}
|
||||
RatesOfChange(store, k4, t);
|
||||
for (int i = 0; i < nEquations; i++) {
|
||||
x[i] = x[i] + (k1[i] + 2.0 * k2[i] + 2.0 * k3[i] + k4[i]) * h / 6.0;
|
||||
}
|
||||
return t + h;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates a single step using Adams Bashforth Moulton,
|
||||
*
|
||||
* @param x Array of values being integrated.
|
||||
* @param t Time at which step begins
|
||||
* @param h Duration of step
|
||||
* @return Error prediction at end of step
|
||||
*/
|
||||
public double abmStep(double[] x, double t, double h) {
|
||||
abmRms2 = 0.0;
|
||||
if (abmSteps == 0) {
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
ym3[i] = x[i];
|
||||
ym2[i] = x[i];
|
||||
}
|
||||
RatesOfChange(dm3, ym3, t);
|
||||
t = RK4Step(ym2, t, h);
|
||||
RatesOfChange(dm2, ym2, t);
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
x[i] = ym2[i];
|
||||
}
|
||||
abmSteps += 1;
|
||||
return 1.0;
|
||||
} else if (abmSteps == 1) {
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
ym1[i] = ym2[i];
|
||||
}
|
||||
t = RK4Step(ym1, t, h);
|
||||
RatesOfChange(dm1, ym1, t);
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
x[i] = ym1[i];
|
||||
}
|
||||
abmSteps += 1;
|
||||
return 1.0;
|
||||
} else {
|
||||
RatesOfChange(k1, x, t);
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
P[i] = x[i] + (h / 24.0) *
|
||||
(55.0 * k1[i] - 59.0 * dm1[i] + 37.0 * dm2[i] - 9.0 * dm3[i]);
|
||||
}
|
||||
RatesOfChange(dp1, P, t + h);
|
||||
abmRms2 = 0.0;
|
||||
for (int i = 0; i < x.Length; i++) {
|
||||
store[i] = x[i];
|
||||
x[i] += (h / 24.0) * (9 * dp1[i] + 19.0 * k1[i] - 5.0 * dm1[i] + dm2[i]);
|
||||
dm3[i] = dm2[i];
|
||||
dm2[i] = dm1[i];
|
||||
dm1[i] = k1[i];
|
||||
ym3[i] = ym2[i];
|
||||
ym2[i] = ym1[i];
|
||||
ym1[i] = store[i];
|
||||
abmRms2 += (x[i] - P[i]) * (x[i] - P[i]) / (x[i] + P[i]) / (x[i] + P[i]);
|
||||
}
|
||||
abmRms2 /= x.Length;
|
||||
if (abmSteps < 5) abmSteps += 1;
|
||||
return t + h;
|
||||
}
|
||||
}
|
||||
|
||||
public double abmError() {
|
||||
return abmRms2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a7efa90a6a125b4bbd9de19f9a99d28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab7306e91cd941c4fafedbd3c621b380
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,365 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 2
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 705507995}
|
||||
- component: {fileID: 705507994}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &705507994
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &705507995
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 705507993}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &963194226
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &963194227
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963194228
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1696623005
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1696623007}
|
||||
- component: {fileID: 1696623006}
|
||||
m_Layer: 0
|
||||
m_Name: BlackHole
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1696623006
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1696623005}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe74eaeeaa11b4d4aa23871a3a419cf2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
a_spinAngularMomentumPerMass: 0.9
|
||||
cameraDistance: 20
|
||||
Camera:
|
||||
Position:
|
||||
R: 74.1
|
||||
Dir:
|
||||
Theta: 1.511
|
||||
Phi: 0
|
||||
Speed:
|
||||
R: 0
|
||||
Dir:
|
||||
Theta: 0
|
||||
Phi: 1
|
||||
Beta: 0.11701780503564688
|
||||
Metric:
|
||||
Delta: 5343.608001
|
||||
Rho: 74.10002404994196
|
||||
OmegaUpLine: 73.9744660403682
|
||||
Omega: 0.00000490975166391538
|
||||
Sigma: 5491.324179049823
|
||||
Alpha: 0.9864124878190217
|
||||
A: 0.999
|
||||
Hole:
|
||||
A: 0.999
|
||||
--- !u!4 &1696623007
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1696623005}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user