Skip to main content

Shape

Enum Shape 

Source
pub enum Shape<'a> {
    Plane,
    Conic {
        c: f64,
        k: f64,
    },
    EvenAsphere(Base<'a>),
    OddAsphere {
        c: f64,
        k: f64,
        b: &'a [f64],
    },
    Toroid {
        c: f64,
        k: f64,
        a: &'a [f64],
        cx: f64,
    },
    Zernike {
        base: Base<'a>,
        terms: Option<&'a ZernSag>,
    },
    GridSag {
        base: Base<'a>,
        terms: Option<&'a ZernSag>,
        grid: Option<&'a GridSag>,
    },
    Tilted {
        tan: [f64; 2],
        c: f64,
        k: f64,
    },
    ConicTilted {
        c: f64,
        k: f64,
        tan: [f64; 2],
    },
    Cylinder(Base<'a>),
    Irregular(Irregular),
    User {
        c: f64,
        k: f64,
        shape: &'a UserShape,
        h: f64,
    },
}
Expand description

面の形(Surface::shape)

Variants§

§

Plane

頂点の平面(Fresnel・Jones・理想レンズ・利用者定義の面、座標ブレーク)

§

Conic

二次曲面(c = 0 は平面)。標準面・Gradium

Fields

§

EvenAsphere(Base<'a>)

偶数次非球面。Even Asphere・Binary 2

§

OddAsphere

Odd Asphere: 二次曲面(c・k)+ Σ b[i] r^{i+1}

Fields

§b: &'a [f64]
§

Toroid

トロイダル面: YZ 面の曲線(c・k・y², y⁴, … の係数 a)を、頂点から 1/cx 離れた Y 軸に平行な軸の周りに回した面 (cx = 0 は円柱面)

Fields

§a: &'a [f64]
§cx: f64
§

Zernike

Zernike Sag: 偶数次非球面 + Zernike の項(Standard か Fringe かは ZernSag::fringe)

Fields

§base: Base<'a>
§terms: Option<&'a ZernSag>
§

GridSag

Grid Sag: 偶数次非球面 + Zernike(Standard)の項 + 格子の補間

Fields

§base: Base<'a>
§terms: Option<&'a ZernSag>
§grid: Option<&'a GridSag>
§

Tilted

Tilted: 平面 z = x tan α + y tan β。c・k は形に効かない残りの値で、従来どおり交点のニュートン法の 初期値(二次曲面との交点)にだけ使う

Fields

§tan: [f64; 2]
§

ConicTilted

標準面 + x tan α + y tan β(Gradient 9 の形。傾きは面の後ろの屈折率分布の値)

Fields

§tan: [f64; 2]
§

Cylinder(Base<'a>)

y だけの偶数次非球面(Cylinder Fresnel の基板)

§

Irregular(Irregular)

§

User

利用者定義の形: 二次曲面(c・k)+ 登録のモデルの矢高(裏返しを含む、crate::usershape)

Fields

§shape: &'a UserShape
§h: f64

近軸の曲率を求める差分の幅 mm(クリア半径に比例)

Implementations§

Source§

impl Shape<'_>

Source

pub fn sag(&self, x: f64, y: f64) -> (f64, f64, f64)

面の局所座標 (x, y) での矢高と (∂z/∂x, ∂z/∂y)。面の外(平方根が負、値のない格子点)は NaN

Source

pub fn is_freeform(&self) -> bool

回転対称でない矢高の面か(Zernike・Grid Sag・Odd Asphere・Tilted・Irregular。瞳を実光線で求める、 交点・法線を一般の矢高で求めるなど)

Source

pub fn paraxial_curv(&self) -> f64

近軸の曲率(YZ 面。トロイダル面も YZ 面で、OpticStudio と同じ)。OpticStudio 26.1 の EFFL に合わせたもの:

  • 偶数次非球面・トロイダル面: c + 2 a₁(r²・y² の項は近軸の曲率に入る)
  • Odd Asphere: c + 2 β₂、Tilted: 0、Irregular: c
  • Zernike Sag: 基準の c + 2 a₁ に、Zernike の項のうち Z4(デフォーカス)の分だけを足す (Standard Z4 = √3 (2ρ² − 1) → 4√3 A4 / R²、Fringe Z4 = 2ρ² − 1 → 4 A4 / R²。偏心は見ない)
  • Grid Sag: 双三次なら頂点での ∂²z/∂y²(格子の補間の分を含む。勾配 ∂z/∂y の中心差分)、双一次は基準の面だけ。 OpticStudio は頂点の ∂²z/∂y² を矢高の差分(刻み 1e-2 mm 程度)で求めるらしく、円錐係数・r^4 以上の項・ 双一次の折れ目の分だけ違う(EFFL で相対 1e-9〜1e-8、頂点が格子点に乗る双一次では大きく違う。 OpticStudio との照合)。ここでは差分を使わない厳密な値にしている
Source

pub fn paraxial_extra(&self) -> Option<f64>

近軸の曲率のうち c に依らない分 e(Shape::paraxial_curv が c + e のとき): 二次曲面・Irregular 0、 偶数次非球面・トロイダル面・Cylinder Fresnel の基板 2 a₁、Odd Asphere 2 β₂。曲率のソルブ(c = 目標の近軸の 曲率 − e)を近軸の追跡と同じ規則にするためのもの。c だけで近軸の曲率が決まらない面(平面・Tilted・ Zernike Sag・Grid Sag)は None

Source§

impl Shape<'_>

Source

pub fn takes(&self, kind: Kind) -> bool

形のパラメータ kind(c・R・k・asph の i 番目・Zernike の項)がこの形を変え、Shape::dsag で微分できるか。

  • 二次曲面: c・k。偶数次非球面・Zernike Sag・Grid Sag: c・k・a(Zernike の項は面に項があるとき)
  • Odd Asphere: c・k・β(asph の i 番目が r^(i+1) の係数)
  • Tilted: tan α・tan β(asph の 0・1 番目)だけ。c・k は形に効かない
  • Irregular: c・k と asph の 0〜7 番目(偏心 x・y、傾き x・y、Zs・Za・Zc、角度)
  • そのほか(トロイダル面・Cylinder Fresnel の基板・Gradient 9 の形・平面): なし(変数にできない面)
Source

pub fn dsag(&self, kind: Kind, x: f64, y: f64) -> Option<[f64; 3]>

矢高と勾配 (z, ∂z/∂x, ∂z/∂y)(Shape::sag)の、形のパラメータ kind による微分(面の局所座標の x・y を 固定)。角度のパラメータ(Irregular の傾き・角度)は度あたり。形を変えないパラメータ(Shape::takes が false)は None

Trait Implementations§

Source§

impl<'a> Clone for Shape<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Shape<'a>

Source§

impl<'a> Debug for Shape<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for Shape<'a>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for Shape<'a>

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Shape<'a>

§

impl<'a> !UnwindSafe for Shape<'a>

§

impl<'a> Freeze for Shape<'a>

§

impl<'a> Send for Shape<'a>

§

impl<'a> Sync for Shape<'a>

§

impl<'a> Unpin for Shape<'a>

§

impl<'a> UnsafeUnpin for Shape<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.