Largest possible circle inside a room

I want to draw the largest possible obstacle-free circle inside a room. If I move any furniture or fixture in Revit, the circle should automatically change its radius. How can I do that in Revit Dynamo? I appreciate your help!

Hey @obidul.line ,

I would suggest using a Delaunay Triangulation/Voronoi Diagram (aka same thing, depending on how you look at it) from your furniture, walls, etc. you have to sample points from them most likely though. Then, the biggest circumcenter in your triangulation is the circle you’re looking for. E.g. something like this:

import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import Voronoi, voronoi_plot_2d


# Plot Voronoi diagram and find the largest empty circle
def plot_largest_empty_circle(vor, obstacles):
    fig, ax = plt.subplots()

    # Plot the Voronoi diagram
    voronoi_plot_2d(vor, ax=ax, show_vertices=False, line_colors='orange')

    largest_circle_radius = 0
    largest_circle_center = None

    # Loop through each Voronoi vertex and check for largest empty circle
    for vertex in vor.vertices:
        # Calculate the distance from the Voronoi vertex to the closest obstacle
        dist_to_obstacle = np.min(np.linalg.norm(obstacles - vertex, axis=1))

        # If this vertex defines a larger circle, store its details
        if dist_to_obstacle > largest_circle_radius:
            largest_circle_radius = dist_to_obstacle
            largest_circle_center = vertex

    # If a largest circle was found, plot it
    if largest_circle_center is not None:
        circle = plt.Circle(largest_circle_center, largest_circle_radius, color='b', fill=False, linestyle='--',
                            linewidth=2)
        ax.add_artist(circle)

    # Mark the center of the largest empty circle (in green)
    ax.scatter(largest_circle_center[0], largest_circle_center[1], color='g',
               label="Centre of largest empty circle Center")

    ax.legend()
    plt.show()


OBSTACLES = np.array([[1, 1], [5, 5], [8, 2], [6, 7], [3, 8], [1, 3], [5, 1], [8, 5], [1, 6]])
VORONOI = Voronoi(OBSTACLES)
plot_largest_empty_circle(VORONOI, OBSTACLES)

Google, “point of inaccessibility”.