honeycomb_core/cmap/dim2/sews/two.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
//! 2D sew implementations
use stm::{atomically, StmResult, Transaction};
use crate::{
attributes::{AttributeStorage, UnknownAttributeStorage},
cmap::{CMap2, CMapResult, DartIdType, NULL_DART_ID},
prelude::CoordsFloat,
};
/// 2-sews
impl<T: CoordsFloat> CMap2<T> {
/// 2-sew operation.
///
/// This operation corresponds to *coherently linking* two darts via the *β<sub>2</sub>*
/// function. For a thorough explanation of this operation (and implied hypothesis &
/// consequences), refer to the [user guide][UG].
///
/// [UG]: https://lihpc-computational-geometry.github.io/honeycomb/
///
/// # Arguments
///
/// - `lhs_dart_id: DartIdentifier` -- ID of the first dart to be linked.
/// - `rhs_dart_id: DartIdentifier` -- ID of the second dart to be linked.
/// - `policy: SewPolicy` -- Geometrical sewing policy to follow.
///
/// After the sewing operation, these darts will verify
/// *β<sub>2</sub>(`lhs_dart`) = `rhs_dart`* and *β<sub>2</sub>(`rhs_dart`) = `lhs_dart`*.
///
/// # Errors
///
/// This method is meant to be called in a context where the returned `Result` is used to
/// validate the transaction passed as argument. The result should not be processed manually.
///
/// The policy in case of failure can be defined through the transaction, using
/// `Transaction::with_control` for construction.
///
/// # Panics
///
/// The method may panic if:
/// - the two darts are not 2-sewable,
/// - the method cannot resolve orientation issues.
#[allow(clippy::too_many_lines)]
pub fn two_sew(
&self,
trans: &mut Transaction,
lhs_dart_id: DartIdType,
rhs_dart_id: DartIdType,
) -> StmResult<()> {
let b1lhs_dart_id = self.betas[(1, lhs_dart_id)].read(trans)?;
let b1rhs_dart_id = self.betas[(1, rhs_dart_id)].read(trans)?;
// match (is lhs 1-free, is rhs 1-free)
match (b1lhs_dart_id == NULL_DART_ID, b1rhs_dart_id == NULL_DART_ID) {
// trivial case, no update needed
(true, true) => {
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
}
// update vertex associated to b1rhs/lhs
(true, false) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let b1rhs_vid_old = self.vertex_id_transac(trans, b1rhs_dart_id)?;
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let lhs_vid_new = self.vertex_id_transac(trans, lhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.merge(trans, lhs_vid_new, lhs_vid_old, b1rhs_vid_old)?;
self.attributes.merge_vertex_attributes(
trans,
lhs_vid_new,
lhs_vid_old,
b1rhs_vid_old,
)?;
self.attributes
.merge_edge_attributes(trans, eid_new, lhs_eid_old, rhs_eid_old)?;
}
// update vertex associated to b1lhs/rhs
(false, true) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
let b1lhs_vid_old = self.vertex_id_transac(trans, b1lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let rhs_vid_new = self.vertex_id_transac(trans, rhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.merge(trans, rhs_vid_new, b1lhs_vid_old, rhs_vid_old)?;
self.attributes.merge_vertex_attributes(
trans,
rhs_vid_new,
b1lhs_vid_old,
rhs_vid_old,
)?;
self.attributes
.merge_edge_attributes(trans, eid_new, lhs_eid_old, rhs_eid_old)?;
}
// update both vertices making up the edge
(false, false) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
// (lhs/b1rhs) vertex
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let b1rhs_vid_old = self.vertex_id_transac(trans, b1rhs_dart_id)?;
// (b1lhs/rhs) vertex
let b1lhs_vid_old = self.vertex_id_transac(trans, b1lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// check orientation
#[rustfmt::skip]
if let (
Some(l_vertex), Some(b1r_vertex), // (lhs/b1rhs) vertices
Some(b1l_vertex), Some(r_vertex), // (b1lhs/rhs) vertices
) = (
self.vertices.read(trans, lhs_vid_old)?, self.vertices.read(trans, b1rhs_vid_old)?,// (lhs/b1rhs)
self.vertices.read(trans, b1lhs_vid_old)?, self.vertices.read(trans, rhs_vid_old)? // (b1lhs/rhs)
)
{
let lhs_vector = b1l_vertex - l_vertex;
let rhs_vector = b1r_vertex - r_vertex;
// dot product should be negative if the two darts have opposite direction
// we could also put restriction on the angle made by the two darts to prevent
// drastic deformation
assert!(
lhs_vector.dot(&rhs_vector) < T::zero(),
"{}",
format!("Dart {lhs_dart_id} and {rhs_dart_id} do not have consistent orientation for 2-sewing"),
);
};
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let lhs_vid_new = self.vertex_id_transac(trans, lhs_dart_id)?;
let rhs_vid_new = self.vertex_id_transac(trans, rhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.merge(trans, lhs_vid_new, lhs_vid_old, b1rhs_vid_old)?;
self.vertices
.merge(trans, rhs_vid_new, b1lhs_vid_old, rhs_vid_old)?;
self.attributes.merge_vertex_attributes(
trans,
lhs_vid_new,
lhs_vid_old,
b1rhs_vid_old,
)?;
self.attributes.merge_vertex_attributes(
trans,
rhs_vid_new,
b1lhs_vid_old,
rhs_vid_old,
)?;
self.attributes
.merge_edge_attributes(trans, eid_new, lhs_eid_old, rhs_eid_old)?;
}
}
Ok(())
}
/// 2-sew two darts.
///
/// This variant is equivalent to `two_sew`, but internally uses a transaction that will be
/// retried until validated.
pub fn force_two_sew(&self, lhs_dart_id: DartIdType, rhs_dart_id: DartIdType) {
atomically(|trans| self.two_sew(trans, lhs_dart_id, rhs_dart_id));
}
/// Attempt to 2-sew two darts.
///
/// # Errors
///
/// This method will fail, returning an error, if:
/// - the transaction cannot be completed
/// - one (or more) attribute merge fails
///
/// The returned error can be used in conjunction with transaction control to avoid any
/// modifications in case of failure at attribute level. The user can then choose, through its
/// transaction control policy, to retry or abort as he wishes.
#[allow(clippy::too_many_lines, clippy::missing_panics_doc)]
pub fn try_two_sew(
&self,
trans: &mut Transaction,
lhs_dart_id: DartIdType,
rhs_dart_id: DartIdType,
) -> CMapResult<()> {
let b1lhs_dart_id = self.betas[(1, lhs_dart_id)].read(trans)?;
let b1rhs_dart_id = self.betas[(1, rhs_dart_id)].read(trans)?;
// match (is lhs 1-free, is rhs 1-free)
match (b1lhs_dart_id == NULL_DART_ID, b1rhs_dart_id == NULL_DART_ID) {
// trivial case, no update needed
(true, true) => {
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
}
// update vertex associated to b1rhs/lhs
(true, false) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let b1rhs_vid_old = self.vertex_id_transac(trans, b1rhs_dart_id)?;
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let lhs_vid_new = self.vertex_id_transac(trans, lhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.try_merge(trans, lhs_vid_new, lhs_vid_old, b1rhs_vid_old)?;
self.attributes.try_merge_vertex_attributes(
trans,
lhs_vid_new,
lhs_vid_old,
b1rhs_vid_old,
)?;
self.attributes.try_merge_edge_attributes(
trans,
eid_new,
lhs_eid_old,
rhs_eid_old,
)?;
}
// update vertex associated to b1lhs/rhs
(false, true) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
let b1lhs_vid_old = self.vertex_id_transac(trans, b1lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let rhs_vid_new = self.vertex_id_transac(trans, rhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.try_merge(trans, rhs_vid_new, b1lhs_vid_old, rhs_vid_old)?;
self.attributes.try_merge_vertex_attributes(
trans,
rhs_vid_new,
b1lhs_vid_old,
rhs_vid_old,
)?;
self.attributes.try_merge_edge_attributes(
trans,
eid_new,
lhs_eid_old,
rhs_eid_old,
)?;
}
// update both vertices making up the edge
(false, false) => {
// fetch vertices ID before topology update
let lhs_eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_eid_old = self.edge_id_transac(trans, b1rhs_dart_id)?;
// (lhs/b1rhs) vertex
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let b1rhs_vid_old = self.vertex_id_transac(trans, b1rhs_dart_id)?;
// (b1lhs/rhs) vertex
let b1lhs_vid_old = self.vertex_id_transac(trans, b1lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// check orientation
#[rustfmt::skip]
if let (
Ok(Some(l_vertex)), Ok(Some(b1r_vertex)), // (lhs/b1rhs) vertices
Ok(Some(b1l_vertex)), Ok(Some(r_vertex)), // (b1lhs/rhs) vertices
) = (
self.vertices.read(trans, lhs_vid_old), self.vertices.read(trans, b1rhs_vid_old),// (lhs/b1rhs)
self.vertices.read(trans, b1lhs_vid_old), self.vertices.read(trans, rhs_vid_old) // (b1lhs/rhs)
)
{
let lhs_vector = b1l_vertex - l_vertex;
let rhs_vector = b1r_vertex - r_vertex;
// dot product should be negative if the two darts have opposite direction
// we could also put restriction on the angle made by the two darts to prevent
// drastic deformation
assert!(
lhs_vector.dot(&rhs_vector) < T::zero(),
"{}",
format!("Dart {lhs_dart_id} and {rhs_dart_id} do not have consistent orientation for 2-sewing"),
);
};
// update the topology
self.betas.two_link_core(trans, lhs_dart_id, rhs_dart_id)?;
// merge vertices & attributes from the old IDs to the new one
let lhs_vid_new = self.vertex_id_transac(trans, lhs_dart_id)?;
let rhs_vid_new = self.vertex_id_transac(trans, rhs_dart_id)?;
let eid_new = self.edge_id_transac(trans, lhs_dart_id)?;
self.vertices
.try_merge(trans, lhs_vid_new, lhs_vid_old, b1rhs_vid_old)?;
self.vertices
.try_merge(trans, rhs_vid_new, b1lhs_vid_old, rhs_vid_old)?;
self.attributes.try_merge_vertex_attributes(
trans,
lhs_vid_new,
lhs_vid_old,
b1rhs_vid_old,
)?;
self.attributes.try_merge_vertex_attributes(
trans,
rhs_vid_new,
b1lhs_vid_old,
rhs_vid_old,
)?;
self.attributes.try_merge_edge_attributes(
trans,
eid_new,
lhs_eid_old,
rhs_eid_old,
)?;
}
}
Ok(())
}
}
/// 2-unsews
impl<T: CoordsFloat> CMap2<T> {
/// 2-unsew operation.
///
/// This operation corresponds to *coherently separating* two darts linked via the
/// *β<sub>2</sub>* function. For a thorough explanation of this operation (and implied
/// hypothesis & consequences), refer to the [user guide][UG].
///
/// [UG]: https://lihpc-computational-geometry.github.io/honeycomb/
///
/// # Arguments
///
/// - `lhs_dart_id: DartIdentifier` -- ID of the dart to separate.
/// - `policy: UnsewPolicy` -- Geometrical unsewing policy to follow.
///
/// Note that we do not need to take two darts as arguments since the second dart can be
/// obtained through the *β<sub>2</sub>* function.
///
/// # Errors
///
/// This method is meant to be called in a context where the returned `Result` is used to
/// validate the transaction passed as argument. The result should not be processed manually.
///
/// The policy in case of failure can be defined through the transaction, using
/// `Transaction::with_control` for construction.
///
/// # Panics
///
/// The method may panic if there's a missing attribute at the splitting step. While the
/// implementation could fall back to a simple unlink operation, it probably should have been
/// called by the user, instead of unsew, in the first place.
pub fn two_unsew(&self, trans: &mut Transaction, lhs_dart_id: DartIdType) -> StmResult<()> {
let rhs_dart_id = self.betas[(2, lhs_dart_id)].read(trans)?;
let b1lhs_dart_id = self.betas[(1, lhs_dart_id)].read(trans)?;
let b1rhs_dart_id = self.betas[(1, rhs_dart_id)].read(trans)?;
// match (is lhs 1-free, is rhs 1-free)
match (b1lhs_dart_id == NULL_DART_ID, b1rhs_dart_id == NULL_DART_ID) {
(true, true) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split attributes from the old ID to the new ones
self.attributes
.split_edge_attributes(trans, lhs_dart_id, rhs_dart_id, eid_old)?;
}
(true, false) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertex & attributes from the old ID to the new ones
self.attributes
.split_edge_attributes(trans, lhs_dart_id, rhs_dart_id, eid_old)?;
let (new_lv_lhs, new_lv_rhs) = (
self.vertex_id_transac(trans, lhs_dart_id)?,
self.vertex_id_transac(trans, b1rhs_dart_id)?,
);
self.attributes.split_vertex_attributes(
trans,
new_lv_lhs,
new_lv_rhs,
lhs_vid_old,
)?;
}
(false, true) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertex & attributes from the old ID to the new ones
self.attributes
.split_edge_attributes(trans, lhs_dart_id, rhs_dart_id, eid_old)?;
let (new_rv_lhs, new_rv_rhs) = (
self.vertex_id_transac(trans, b1lhs_dart_id)?,
self.vertex_id_transac(trans, rhs_dart_id)?,
);
self.attributes.split_vertex_attributes(
trans,
new_rv_lhs,
new_rv_rhs,
rhs_vid_old,
)?;
}
(false, false) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertices & attributes from the old ID to the new ones
// FIXME: VertexIdentifier should be cast to DartIdentifier
self.attributes
.split_edge_attributes(trans, lhs_dart_id, rhs_dart_id, eid_old)?;
let (new_lv_lhs, new_lv_rhs) = (
self.vertex_id_transac(trans, lhs_dart_id)?,
self.vertex_id_transac(trans, b1rhs_dart_id)?,
);
let (new_rv_lhs, new_rv_rhs) = (
self.vertex_id_transac(trans, b1lhs_dart_id)?,
self.vertex_id_transac(trans, rhs_dart_id)?,
);
self.attributes.split_vertex_attributes(
trans,
new_lv_lhs,
new_lv_rhs,
lhs_vid_old,
)?;
self.attributes.split_vertex_attributes(
trans,
new_rv_lhs,
new_rv_rhs,
rhs_vid_old,
)?;
}
}
Ok(())
}
/// 2-unsew two darts.
///
/// This variant is equivalent to `two_unsew`, but internally uses a transaction that will
/// be retried until validated.
pub fn force_two_unsew(&self, lhs_dart_id: DartIdType) {
atomically(|trans| self.two_unsew(trans, lhs_dart_id));
}
/// Attempt to 2-unsew two darts.
///
/// # Errors
///
/// This method will fail, returning an error, if:
/// - the transaction cannot be completed
/// - one (or more) attribute merge fails
///
/// The returned error can be used in conjunction with transaction control to avoid any
/// modifications in case of failure at attribute level. The user can then choose, through its
/// transaction control policy, to retry or abort as he wishes.
pub fn try_two_unsew(
&self,
trans: &mut Transaction,
lhs_dart_id: DartIdType,
) -> CMapResult<()> {
let rhs_dart_id = self.betas[(2, lhs_dart_id)].read(trans)?;
let b1lhs_dart_id = self.betas[(1, lhs_dart_id)].read(trans)?;
let b1rhs_dart_id = self.betas[(1, rhs_dart_id)].read(trans)?;
// match (is lhs 1-free, is rhs 1-free)
match (b1lhs_dart_id == NULL_DART_ID, b1rhs_dart_id == NULL_DART_ID) {
(true, true) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split attributes from the old ID to the new ones
// FIXME: VertexIdentifier should be cast to DartIdentifier
self.attributes.try_split_edge_attributes(
trans,
lhs_dart_id,
rhs_dart_id,
eid_old,
)?;
}
(true, false) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertex & attributes from the old ID to the new ones
// FIXME: VertexIdentifier should be cast to DartIdentifier
self.attributes.try_split_edge_attributes(
trans,
lhs_dart_id,
rhs_dart_id,
eid_old,
)?;
let (new_lv_lhs, new_lv_rhs) = (
self.vertex_id_transac(trans, lhs_dart_id)?,
self.vertex_id_transac(trans, b1rhs_dart_id)?,
);
self.attributes.try_split_vertex_attributes(
trans,
new_lv_lhs,
new_lv_rhs,
lhs_vid_old,
)?;
}
(false, true) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertex & attributes from the old ID to the new ones
// FIXME: VertexIdentifier should be cast to DartIdentifier
self.attributes.try_split_edge_attributes(
trans,
lhs_dart_id,
rhs_dart_id,
eid_old,
)?;
let (new_rv_lhs, new_rv_rhs) = (
self.vertex_id_transac(trans, b1lhs_dart_id)?,
self.vertex_id_transac(trans, rhs_dart_id)?,
);
self.attributes.try_split_vertex_attributes(
trans,
new_rv_lhs,
new_rv_rhs,
rhs_vid_old,
)?;
}
(false, false) => {
// fetch IDs before topology update
let eid_old = self.edge_id_transac(trans, lhs_dart_id)?;
let lhs_vid_old = self.vertex_id_transac(trans, lhs_dart_id)?;
let rhs_vid_old = self.vertex_id_transac(trans, rhs_dart_id)?;
// update the topology
self.betas.two_unlink_core(trans, lhs_dart_id)?;
// split vertices & attributes from the old ID to the new ones
// FIXME: VertexIdentifier should be cast to DartIdentifier
self.attributes.try_split_edge_attributes(
trans,
lhs_dart_id,
rhs_dart_id,
eid_old,
)?;
let (new_lv_lhs, new_lv_rhs) = (
self.vertex_id_transac(trans, lhs_dart_id)?,
self.vertex_id_transac(trans, b1rhs_dart_id)?,
);
let (new_rv_lhs, new_rv_rhs) = (
self.vertex_id_transac(trans, b1lhs_dart_id)?,
self.vertex_id_transac(trans, rhs_dart_id)?,
);
self.attributes.try_split_vertex_attributes(
trans,
new_lv_lhs,
new_lv_rhs,
lhs_vid_old,
)?;
self.attributes.try_split_vertex_attributes(
trans,
new_rv_lhs,
new_rv_rhs,
rhs_vid_old,
)?;
}
}
Ok(())
}
}