Handle header has no newline or space after OFF. (#665)

Summary:
Allow a line like `OFF10 10 10` as the start of an OFF file. Such things apparently occur in ModelNet40.

This resolves https://github.com/facebookresearch/pytorch3d/issues/663.

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/665

Test Plan: New test

Reviewed By: nikhilaravi

Differential Revision: D28180006

Pulled By: bottler

fbshipit-source-id: 7f474c6a262e32da012217e09f76e8672a7f0278
This commit is contained in:
Daisy
2021-05-07 05:01:20 -07:00
committed by Facebook GitHub Bot
parent 34163326b2
commit 5241b7dd4e
2 changed files with 16 additions and 6 deletions

View File

@@ -254,6 +254,11 @@ class TestMeshOffIO(TestCaseMixin, unittest.TestCase):
lines2[0] = "OFF " + lines[0]
load(lines2)
# OFF line can be merged in to the first line with no space
lines2 = lines.copy()
lines2[0] = "OFF" + lines[0]
load(lines2)
with self.assertRaisesRegex(ValueError, "Not enough face data."):
load(lines[:-1])