Page MenuHomePhabricator

Geometry.hpp
ClosedPublic

Authored by imirzali on Feb 1 2020, 6:03 AM.

Details

Summary

Create the base for the Geometry abstraction.

Test Plan

manual, tests in making

Diff Detail

Repository
rA Anari
Branch
geometry
Lint
Lint Passed

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Restricted Application returned this revision to the author for changes because remote builds failed.Feb 1 2020, 6:03 AM
Restricted Application failed remote builds in Restricted Buildable!
  • Improve Resolution class and make appropriate adjustments

Build is green

Building Anari on mpm-bionic-0000wtx9ht5g1 as build 103.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/103/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Feb 2 2020, 11:11 AM
  • Create first draft of Curve class
  • Improve and fix issues with Curve class
  • Remove copy assignment operator & copy constructor for now

Build has FAILED

Building Anari on mpm-bionic-0000zf0izo3g2 as build 104.

Link to build: https://jenkins.mousepawmedia.net:8449/job/anari_build/104/
See console output for more information: https://jenkins.mousepawmedia.net:8449/job/anari_build/104/console

Restricted Application failed remote builds in Restricted Buildable!Feb 2 2020, 1:12 PM
  • Fix constructor initializer list

Build is green

Building Anari on mpm-bionic-0000zgv05rfnu as build 105.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/105/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Feb 2 2020, 1:15 PM
jcmcdonald added inline comments.
anari-source/include/anari/geometry.hpp
24

You need two other constructors for Curve as well:

  • Copy constructor: Curve(const Curve& cpy)
  • (Possibly) Move constructor: Curve(Curve&& mov)

As a rule, *always* either explicitly declare or delete your copy constructor, as well as (possibly) your move constructor.

Also consider adding a constructor which can accept an initial segment.

69

You also need your assignment operators for copying and (possibly) moving from another Curve(): operator=(const Curve& cpy) and operator=(Curve&& mov). Like the corresponding constructors, these are two functions you should almost always define on data-oriented objects like this.

It may also be worthwhile adding operator+(Segment) and operator+(Curve) (as well as the += counterparts).

This revision now requires changes to proceed.Feb 24 2020, 6:35 PM
imirzali marked an inline comment as done.
  • Add copy and move constructor to Curve
  • Add copy assignment operator

Build has FAILED

Building Anari on mpm-bionic-0000xk8xtped4 as build 112.

Link to build: https://jenkins.mousepawmedia.net:8449/job/anari_build/112/
See console output for more information: https://jenkins.mousepawmedia.net:8449/job/anari_build/112/console

Restricted Application failed remote builds in Restricted Buildable!Mar 1 2020, 2:24 PM
  • Add resolution tests
  • Fix issue with CMake
  • Fix operator overloads and constructor

Build is green

Building Anari on mpm-bionic-00064kaw9rukx as build 113.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/113/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Mar 7 2020, 4:57 PM
imirzali marked an inline comment as done.
  • Add resolution copying tests
  • Add curve tests
  • Add constructor for instantiating from a segment

Build is green

Building Anari on mpm-bionic-0006sisw9n73i as build 114.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/114/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Mar 8 2020, 12:43 PM
imirzali mentioned this in Unknown Object (Maniphest Task).Mar 8 2020, 1:00 PM
  • Add constructor for instantiating from a segment

Build is green

Building Anari on mpm-bionic-0004ahdvjj5y8 as build 115.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/115/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Mar 15 2020, 2:52 PM

Getting there! A few more comments for you...

anari-source/include/anari/geometry.hpp
57–60

Wouldn't we want to allow reassignment?

97

The convention is indeed to just use if (segmentClosed), not spell out == true`.

anari-source/include/anari/geometry_tests.hpp
68 ↗(On Diff #1291)

This is something you want to avoid. Either test each of these behaviors separately before this test, or else directly access the attributes in question. You want a test to have a specific place to break, and a specific reason to break. Otherwise, debugging the test when it fails gets hard.

anari-source/src/geometry_tests.cpp
11–12 ↗(On Diff #1291)

A full test suite should separately test each constructor, operator, and function of the class being tested. (This is what is meant by "code coverage")

This revision now requires changes to proceed.Mar 23 2020, 3:53 PM

@imirzali This needs to be wrapped up and landed ASAP, so as to unblock T1301: Refactoring Geometry Using Eigen (which MUST be a separate task!)

imirzali added inline comments.
anari-source/include/anari/geometry.hpp
57–60

Don't quite get what you mean here.

  • Add tests and address suggested changes

Build is green

Building Anari on mpm-bionic-0004bgikbfseh as build 124.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/124/ for more details.

Restricted Application completed remote builds in Restricted Buildable.Apr 19 2020, 12:11 PM
anari-source/include/anari/geometry.hpp
12

How does a segment work exactly. Where do the x1/x2, y1/y2, cx1/cx2, cy1/cy2 factor into? What do they represent exactly? I have an idea but I want to confirm before moving forward.

Build is green

Building Anari on mpm-bionic-000adx851c7l7 as build 126.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/126/ for more details.

Small detail only.

I think this is about ready to land, pending my one detail and an answer to @gacmix's question inline. I'll let you tackle the rest of the tests as you go in the next Differential. Just be sure not to put them off towards the end! Write them as you go. You may even consider writing a test before you write the functionality being tested (Test-Driven Development), if that workflow will help you get these done.

anari-source/include/anari/geometry.hpp
57–60

Uhm...no, I think I read it wrong.

This time around, it makes even less sense. FlexArray::clear() always returns true (I should change it to not return anything), and it never throws an exception, so this clause really would never happen.

This revision now requires changes to proceed.Apr 27 2020, 5:53 PM
imirzali marked an inline comment as done.
imirzali added inline comments.
anari-source/include/anari/geometry.hpp
12

image.png (183×432 px, 7 KB)

Essentially there are control points, beginning points of the curve and the endpoint. The ones starting with c imply a control point.

imirzali marked 3 inline comments as done.
  • Fix unnecessary check

Build is green

Building Anari on mpm-bionic-000ayhd0fy4qx as build 127.

See https://jenkins.mousepawmedia.net:8449/job/anari_build/127/ for more details.

Restricted Application completed remote builds in Restricted Buildable.May 10 2020, 10:57 AM
This revision is now accepted and ready to land.May 16 2020, 11:14 AM
This revision was automatically updated to reflect the committed changes.