forked from StudioInfinity/dyna3
Add an off-center test assembly
This test assembly should provide a simple example where the loss function is saddle-shaped near its manifold of minima.
This commit is contained in:
parent
27a8cbfd69
commit
9c22eebb46
1 changed files with 37 additions and 0 deletions
|
@ -300,6 +300,41 @@ fn load_balanced_assemb(assembly: &Assembly) {
|
|||
}
|
||||
}
|
||||
|
||||
/* DEBUG */
|
||||
// the initial configuration of this test assembly deliberately violates the
|
||||
// constraints, so loading the assembly will trigger a non-trivial realization
|
||||
fn load_off_center_assemb(assembly: &Assembly) {
|
||||
// create a point almost at the origin and a sphere centered on the origin
|
||||
let _ = assembly.try_insert_element(
|
||||
Point::new(
|
||||
"point".to_string(),
|
||||
"Point".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::point(1e-9, 0.0, 0.0)
|
||||
),
|
||||
);
|
||||
let _ = assembly.try_insert_element(
|
||||
Sphere::new(
|
||||
"sphere".to_string(),
|
||||
"Sphere".to_string(),
|
||||
[0.75_f32, 0.75_f32, 0.75_f32],
|
||||
engine::sphere(0.0, 0.0, 0.0, 1.0)
|
||||
),
|
||||
);
|
||||
|
||||
// get references to the elements
|
||||
let point_and_sphere = ["point", "sphere"].map(
|
||||
|id| assembly.elements_by_id.with_untracked(
|
||||
|elts_by_id| elts_by_id[id].clone()
|
||||
)
|
||||
);
|
||||
|
||||
// put the point on the sphere
|
||||
let incidence = InversiveDistanceRegulator::new(point_and_sphere);
|
||||
incidence.set_point.set(SpecifiedValue::try_from("0".to_string()).unwrap());
|
||||
assembly.insert_regulator(Rc::new(incidence));
|
||||
}
|
||||
|
||||
// setting the inversive distances between the vertices to -2 gives a regular
|
||||
// tetrahedron with side length 1, whose insphere and circumsphere have radii
|
||||
// sqrt(1/6) and sqrt(3/2), respectively. to measure those radii, set an
|
||||
|
@ -570,6 +605,7 @@ pub fn AddRemove() -> View {
|
|||
"low-curv" => load_low_curv_assemb(assembly),
|
||||
"pointed" => load_pointed_assemb(assembly),
|
||||
"balanced" => load_balanced_assemb(assembly),
|
||||
"off-center" => load_off_center_assemb(assembly),
|
||||
"radius-ratio" => load_radius_ratio_assemb(assembly),
|
||||
"irisawa-hexlet" => load_irisawa_hexlet_assemb(assembly),
|
||||
_ => ()
|
||||
|
@ -624,6 +660,7 @@ pub fn AddRemove() -> View {
|
|||
option(value="low-curv") { "Low-curvature" }
|
||||
option(value="pointed") { "Pointed" }
|
||||
option(value="balanced") { "Balanced" }
|
||||
option(value="off-center") { "Off-center" }
|
||||
option(value="radius-ratio") { "Radius ratio" }
|
||||
option(value="irisawa-hexlet") { "Irisawa hexlet" }
|
||||
option(value="empty") { "Empty" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue