Skip to content

new files and modified files - #990

Open
zama9 wants to merge 11 commits into
masterfrom
zama-test-test-branch
Open

new files and modified files#990
zama9 wants to merge 11 commits into
masterfrom
zama-test-test-branch

Conversation

@zama9

@zama9 zama9 commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Adds incremental rectangle and circle packing layouts with historical position preservation and registers them for city rendering.

Changes:

  • Implements incremental rectangle and circle packing algorithms.
  • Extends packing models with hierarchy and history metadata.
  • Adds new layout kinds and renderer factories.

Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Fixed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Fixed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalCirclePackingNodeLayout.cs Fixed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Fixed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds incremental rectangle and circle packing layouts with historical position preservation and registers them for city rendering.

Changes:

  • Implements incremental rectangle and circle packing algorithms.
  • Extends packing models with hierarchy and history metadata.
  • Adds new layout kinds and renderer factories.

Reviewed changes

Copilot reviewed 11 out of 17 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
Assets/SEE/Layout/NodeTransform.cs Associates transforms with packed nodes.
Assets/SEE/Layout/NodeLayouts/RectanglePacking/PTree.cs Adds incremental rectangle operations.
Assets/SEE/Layout/NodeLayouts/RectanglePacking/PNode.cs Adds hierarchy and rectangle metadata.
Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Implements incremental rectangle packing.
Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs.meta Adds Unity metadata.
Assets/SEE/Layout/NodeLayouts/IncrementalCirclePackingNodeLayout.cs Implements incremental circle layout integration.
Assets/SEE/Layout/NodeLayouts/IncrementalCirclePackingNodeLayout.cs.meta Adds Unity metadata.
Assets/SEE/Layout/NodeLayouts/CirclePacking/TheCircle.cs Defines incremental circle state.
Assets/SEE/Layout/NodeLayouts/CirclePacking/TheCircle.cs.meta Adds Unity metadata.
Assets/SEE/Layout/NodeLayouts/CirclePacking/SpatialHashGrid.cs Adds spatial collision lookup.
Assets/SEE/Layout/NodeLayouts/CirclePacking/SpatialHashGrid.cs.meta Adds Unity metadata.
Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs Adds PBD-based circle relaxation.
Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs.meta Adds Unity metadata.
Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs Adds history-aware circle placement.
Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs.meta Adds Unity metadata.
Assets/SEE/Game/CityRendering/GraphRenderer.cs Instantiates the new layouts.
Assets/SEE/Game/City/NodeLayoutKind.cs Registers new layout kinds.
Files not reviewed (6)
  • Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs.meta: Generated file
  • Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs.meta: Generated file
  • Assets/SEE/Layout/NodeLayouts/CirclePacking/SpatialHashGrid.cs.meta: Generated file
  • Assets/SEE/Layout/NodeLayouts/CirclePacking/TheCircle.cs.meta: Generated file
  • Assets/SEE/Layout/NodeLayouts/IncrementalCirclePackingNodeLayout.cs.meta: Generated file
  • Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs.meta: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PTree.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Outdated
Comment on lines +74 to +95
foreach (TheCircle c in dealingCircles)
{
(string, float, Vector2) tupple = bufferLastPos.FirstOrDefault(l => l.Item1 == c.ID);
if (c.Radius < c.nextRadius)
{
ExpandFromCircleA(circles, c, c.nextRadius);
}
else if (c.Radius > c.nextRadius)
{
c.Radius = c.nextRadius;
}

List<TheCircle> notPlacedCircles = circles.Where(c => !c.IsPlaced).ToList();

newNodeIDsSizes = notPlacedCircles.Select(n => (n.ID, n.Radius)).ToList();

PackingCircles(circles, containerCenter, out containerRadius, newNodeIDsSizes);

List<(string, float, Vector2)> placedCircles = circles.Select(c => (c.ID, c.Radius, c.Center)).ToList();

lastPositions[parent] = placedCircles;
}
Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PNode.cs
Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PNode.cs
Comment on lines +322 to +325
if (R > largestRadius)
{
largestRadius = R;
best = new TheCircle(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it produces the largest radius which encloses the set of circles as close as possible this is what it meant to do

Comment on lines +394 to +398
if (R > largestRadius)
{
largestRadius = R;
best = new TheCircle(
null,

@koschke koschke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the code only superficially looking for coding style violations only. Not for semantic problems.

Please fix those.

Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs Outdated
/// <summary>
/// Finds an empty position for the given circle that does not overlap with already placed circles.
/// </summary>
/// <param name="placedCircles"></param>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation.

/// <summary>
/// Checks if the given position and radius overlaps with any of the already placed circles.
/// </summary>
/// <param name="pos"></param>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation.

/// Computes the smallest circle that can surround all the given circles,
/// returning a new circle with the computed center and radius.
/// </summary>
/// <param name="circles"></param>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation.

/// Computes the smallest circle that can surround all the given circles,
/// and resets the positions of all circles to be relative to the surrounding circle.
/// </summary>
/// <param name="circles"></param>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation.

internal TheCircle ComputeSurroundingCircleAndResetCircles(List<TheCircle> circles)
{
if (circles.Count == 0) { return new TheCircle(null, Vector2.zero, 0); }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove blank line.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few bad patterns I found which you should check.

public class IncrementalCirclePacker
{
/// <summary>
/// Packs the given list of circles into a container, adjusting

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Packs the given list of circles into a container, adjusting
/// Packs the given list of circles into a container, adjusting

}

/// <summary>
/// Performs the packing of circles based on their last known positions,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Performs the packing of circles based on their last known positions,
/// Performs the packing of circles based on their last known positions,

}

/// <summary>
/// Packs the given list of circles into a container,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Packs the given list of circles into a container,
/// Packs the given list of circles into a container,

}

/// <summary>
/// Computes the smallest circle that can surround all the given circles,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Computes the smallest circle that can surround all the given circles,
/// Computes the smallest circle that can surround all the given circles,


/// <summary>
/// Implements a mass-weighted centripetal relaxation algorithm to pack circles densely in a 2D space.
/// Utilizing Position-Based Dynamics (PBD), this class creates a tightly nested, center-seeking cluster

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Utilizing Position-Based Dynamics (PBD), this class creates a tightly nested, center-seeking cluster
/// Utilizing Position-Based Dynamics (PBD), this class creates a tightly nested, center-seeking cluster

/// This layout packs rectangles closely together as a set of nested packed rectangles to decrease
/// the total area of city. It also ensures that the layout is incremental, meaning that if a node
/// is added or removed, the layout will adjust accordingly without having to recompute the entire
/// layout from scratch. The algorithm finds the best position for each rectangle based on its size

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// layout from scratch. The algorithm finds the best position for each rectangle based on its size
/// layout from scratch. The algorithm finds the best position for each rectangle based on its size

}

/// <summary>
/// A reference to the layout calculated in the previous frame or state.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// A reference to the layout calculated in the previous frame or state.
/// A reference to the layout calculated in the previous frame or state.

/// <summary>
/// A reference to the layout calculated in the previous frame or state.
/// This is strictly required for the "incremental" aspect of the layout, as the algorithm
/// uses the positions from this old layout to try and keep nodes as close to their previous

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// uses the positions from this old layout to try and keep nodes as close to their previous
/// uses the positions from this old layout to try and keep nodes as close to their previous

public IncrementalRectanglePackingLayout oldLayout;

/// <summary>
/// Implements the IIncrementalNodeLayout interface property. Provides a safe setter to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// Implements the IIncrementalNodeLayout interface property. Provides a safe setter to
/// Implements the IIncrementalNodeLayout interface property. Provides a safe setter to


/// <summary>
/// Implements the IIncrementalNodeLayout interface property. Provides a safe setter to
/// inject the previous layout instance. It ensures type safety by throwing an ArgumentException

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Trailing whitespace detected! Please remove it.

Suggested change
/// inject the previous layout instance. It ensures type safety by throwing an ArgumentException
/// inject the previous layout instance. It ensures type safety by throwing an ArgumentException

@zama9
zama9 requested a review from koschke September 3, 2026 13:27
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalCirclePackingNodeLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePackerExtended.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Fixed
Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PNode.cs Fixed

@koschke koschke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still many open issues left raised by Copilot and me. There are new issues with trailing whitespaces.

Please fix those.

Comment thread Assets/SEE/Layout/NodeTransform.cs Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few bad patterns I found which you should check.

Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/CirclePacking/IncrementalCirclePacker.cs Dismissed

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few bad patterns I found which you should check.

Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PTree.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/RectanglePacking/PTree.cs Outdated
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed
Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Dismissed

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few bad patterns I found which you should check.

Comment thread Assets/SEE/Layout/NodeLayouts/IncrementalRectanglePackingLayout.cs Outdated
@zama9
zama9 requested a balanced review from Copilot September 5, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zama9
zama9 requested review from koschke and a balanced review from Copilot September 5, 2026 19:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zama9
zama9 requested a balanced review from Copilot September 6, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants