forked from StudioInfinity/dyna3
Implement the uniform inner product for points
This commit is contained in:
parent
03da831c9a
commit
a05a2e1d54
3 changed files with 112 additions and 10 deletions
|
@ -132,6 +132,9 @@ impl ConfigSubspace {
|
|||
// orthonormalize the basis with respect to the projection inner product
|
||||
let basis_proj_orth = basis_proj.qr().q();
|
||||
let basis_std_orth = proj_to_std * &basis_proj_orth;
|
||||
|
||||
// print the projection basis in projection coordinates
|
||||
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
|
||||
console::log_1(&JsValue::from(
|
||||
format!("Basis in projection coordinates:{}", basis_proj_orth)
|
||||
));
|
||||
|
@ -236,19 +239,36 @@ fn basis_matrix(index: (usize, usize), nrows: usize, ncols: usize) -> DMatrix<f6
|
|||
result
|
||||
}
|
||||
|
||||
// given a spacelike unit vector `v`, which represents a sphere, build the basis
|
||||
// for the configuration space given by the three unit translation motions of
|
||||
// the sphere, the unit shrinking motion of the sphere, and `v`
|
||||
// given a normalized vector `v` representing an element, build a basis for the
|
||||
// element's linear configuration space consisting of:
|
||||
// - the unit translation motions of the element
|
||||
// - the unit shrinking motion of the element, if it's a sphere
|
||||
// - one or two vectors whose coefficients vanish on the tangent space of the
|
||||
// normalization variety
|
||||
pub fn local_unif_to_std(v: DVectorView<f64>) -> DMatrix<f64> {
|
||||
const ELEMENT_DIM: usize = 5;
|
||||
let curv = 2.0*v[3];
|
||||
DMatrix::from_column_slice(ELEMENT_DIM, ELEMENT_DIM, &[
|
||||
curv, 0.0, 0.0, 0.0, v[0],
|
||||
0.0, curv, 0.0, 0.0, v[1],
|
||||
0.0, 0.0, curv, 0.0, v[2],
|
||||
curv*v[0], curv*v[1], curv*v[2], curv*v[3], curv*v[4] + 1.0,
|
||||
v[0], v[1], v[2], v[3], v[4]
|
||||
])
|
||||
if v.dot(&(&*Q * v)) < 0.5 {
|
||||
// `v` represents a point. the normalization condition says that the
|
||||
// curvature component of `v` is 1/2
|
||||
DMatrix::from_column_slice(ELEMENT_DIM, ELEMENT_DIM, &[
|
||||
curv, 0.0, 0.0, 0.0, v[0],
|
||||
0.0, curv, 0.0, 0.0, v[1],
|
||||
0.0, 0.0, curv, 0.0, v[2],
|
||||
v[0], v[1], v[2], v[3], v[4],
|
||||
0.0, 0.0, 0.0, 0.0, 1.0
|
||||
])
|
||||
} else {
|
||||
// `v` represents a sphere. the normalization condition says that the
|
||||
// Lorentz product of `v` with itself is 1
|
||||
DMatrix::from_column_slice(ELEMENT_DIM, ELEMENT_DIM, &[
|
||||
curv, 0.0, 0.0, 0.0, v[0],
|
||||
0.0, curv, 0.0, 0.0, v[1],
|
||||
0.0, 0.0, curv, 0.0, v[2],
|
||||
curv*v[0], curv*v[1], curv*v[2], curv*v[3], curv*v[4] + 1.0,
|
||||
v[0], v[1], v[2], v[3], v[4]
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// use backtracking line search to find a better configuration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue