ManimCommunity / ManimCommunity/manim

TransformMatchingShapes uses shapes outside transformation

Open
#2,910 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior

I have two different MarkupTexts arranged in a column: one up and one down.
Each text gets transformed via `TransformMatchingShapes`. The text above gets replaced with another one above, and the same for the texts below.
However, some of the letters from the upper text get transformed to letters on the lower text, and viceversa.

## Expected behavior
I was expecting to only match shapes (or in this case, letters) inside the two elements of the transformation, not to shapes belonging to objects not involved in the transformation.

## How to reproduce the issue

Code for reproducing the problem

```py
import manim

class TestTransformMatchingShapesTwoTexts(manim.Scene):
def construct(self):
mtext1 = manim.MarkupText('Nereak ogia jaten du').shift(manim.UP)
mtext2 = manim.MarkupText('Maitanek Mikeli eskua hartzen dio').shift(manim.DOWN)

self.play(manim.Write(mtext1), manim.Write(mtext2))

mtext3 = manim.MarkupText('Nerea ogia jaten ari da').shift(manim.UP)
mtext4 = manim.MarkupText('Maitane Mikeli eskua hartzen zaio').shift(manim.DOWN)
self.play(manim.TransformMatchingShapes(mtext1, mtext3))
self.play(manim.TransformMatchingShapes(mtext2, mtext4))
```

## Additional media files

Images/GIFs

https://user-images.githubusercontent.com/33621634/182633701-8a119178-02cc-4874-8287-bb7d46e4c57c.mp4

## System specifications

System Details

- Windows 10 Home 21H1
- RAM: 8 GB
- Python version: 3.10.5
- Installed modules:
```
Package Version
------------------- ------------
certifi 2022.6.15
charset-normalizer 2.1.0
click 8.1.3
click-default-group 1.2.2
cloup 0.13.1
colorama 0.4.5
colour 0.1.5
commonmark 0.9.1
decorator 5.1.1
glcontext 2.3.6
idna 3.3
isosurfaces 0.1.0
manim 0.16.0.post0
ManimPango 0.4.1
mapbox-earcut 0.12.11
moderngl 5.6.4
moderngl-window 2.4.1
multipledispatch 0.6.0
networkx 2.8.4
numpy 1.23.0
Pillow 9.1.1
pip 22.2.1
pycairo 1.21.0
pydub 0.25.1
pyglet 1.5.26
Pygments 2.12.0
pyrr 0.10.3
requests 2.28.1
rich 12.4.4
scipy 1.8.1
screeninfo 0.8
setuptools 58.1.0
six 1.16.0
skia-pathops 0.7.2
srt 3.5.2
tqdm 4.64.0
urllib3 1.26.9
watchdog 2.1.9
wheel 0.37.1
```

FFMPEG

Output of `ffmpeg -version`:

```
ffmpeg version 5.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
```

## Additional comments

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided TestTransformMatchingShapesTwoTexts.construct reproduction and trace TransformMatchingShapes while running the two vertically separated MarkupTexts. Add a regression test covering both transformations, with completion shown when shapes from the unrelated text are no longer matched across transformations.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.