Struct evosim::blob::geno_blob_builder::BlobGeno
source · pub struct BlobGeno {
pub vec_tree: QuadTree<GenericGenoNode>,
}
Expand description
The Geno for morphyology of the blob.
The Geno is a QuadTree (it can be represented as TernaryTree as well).
index 0,1,2,3 means up,down,left,right (one of them can be ParentIndicator)
Fields§
§vec_tree: QuadTree<GenericGenoNode>
Implementations§
source§impl BlobGeno
impl BlobGeno
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
checker function to check the genotype is valid or not.
Not valid means self-conflit limbs
sourcepub fn leaf_nodes(&self) -> Vec<usize>
pub fn leaf_nodes(&self) -> Vec<usize>
all nodes don’t have child, used for mutate to lose limb
can not return root, can not return parent indicator
sourcepub fn assign_nn_id_to_root(&mut self, id: usize)
pub fn assign_nn_id_to_root(&mut self, id: usize)
assign an nn_id to root (sometimes builder don’t need new random geno)
sourcepub fn all_usize_nn_ids(&self) -> Vec<usize>
pub fn all_usize_nn_ids(&self) -> Vec<usize>
get reference for all nn_id, in usize rather than Option<usize>
sourcepub fn all_nn_ids_mut(&mut self) -> Vec<&mut Option<usize>>
pub fn all_nn_ids_mut(&mut self) -> Vec<&mut Option<usize>>
get mut reference for all nn_id in the geno
pub fn all_nn_ids_indices(&self) -> Vec<usize>
sourcepub fn move_subtree_nodes_root(
&mut self,
old_size: [f32; 2],
new_size: [f32; 2]
)
pub fn move_subtree_nodes_root( &mut self, old_size: [f32; 2], new_size: [f32; 2] )
push all subtrees outside if the root block’s size changed
sourcepub fn move_subtree_nodes(
&mut self,
root_index: usize,
move_vec: ([f32; 2], [f32; 2], [f32; 2])
)
pub fn move_subtree_nodes( &mut self, root_index: usize, move_vec: ([f32; 2], [f32; 2], [f32; 2]) )
only used for morphyology mutation, update the center
in each genonode,
so that the validation check can preform
this function only works for non-root block’s mutation
pub fn change_node_size(&mut self, index: usize, new_size: [f32; 2])
Trait Implementations§
source§impl<'de> Deserialize<'de> for BlobGeno
impl<'de> Deserialize<'de> for BlobGeno
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Auto Trait Implementations§
impl RefUnwindSafe for BlobGeno
impl Send for BlobGeno
impl Sync for BlobGeno
impl Unpin for BlobGeno
impl UnwindSafe for BlobGeno
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist.§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere C: Component,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given [World]source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Serialize for Twhere
T: Serialize + ?Sized,
impl<T> Serialize for Twhere T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.