Skip to content

Commit

Permalink
Merge pull request #1435 from trzy/platforms2
Browse files Browse the repository at this point in the history
Platforms2
  • Loading branch information
StephenHodgson authored Feb 8, 2018
2 parents f76657a + c975eb7 commit da3116b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ public void Query_Topology_FindPositionsPlaceable()
HandleResults_Topology("Find Placeable Positions", locationCount, new Vector3(0.25f, 0.025f, 0.25f), Color.cyan);
}

public void Query_Topology_FindLargePositionsSittable()
{
// Setup
float minHeight = 0.125f;
float maxHeight = 2.0f;
float minFacingClearance = 1.0f;
float minWidth = .5f;

// Only if we're enabled
if (!SpatialUnderstanding.Instance.AllowSpatialUnderstanding)
{
return;
}

// Query
IntPtr resultsTopologyPtr = SpatialUnderstanding.Instance.UnderstandingDLL.PinObject(resultsTopology);
int locationCount = SpatialUnderstandingDllTopology.QueryTopology_FindLargePositionsSittable(
minHeight, maxHeight, minFacingClearance, minWidth,
resultsTopology.Length, resultsTopologyPtr);

// Output
HandleResults_Topology("Find Large Sittable Positions", locationCount, new Vector3(minWidth, 0.025f, minWidth), Color.cyan);
}

public void Query_Shape_FindPositionsOnShape(string shapeName)
{
// Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ private void SetupMenus()
AddButton("Positions on floor", Panels.Topology, () => { SpaceVisualizer.Instance.Query_Topology_FindPositionsOnFloor(); timeLastQuery = DateTime.MinValue; });
AddButton("Large positions on floor", Panels.Topology, () => { SpaceVisualizer.Instance.Query_Topology_FindLargestPositionsOnFloor(); timeLastQuery = DateTime.MinValue; });
AddButton("Place objects positions", Panels.Topology, () => { SpaceVisualizer.Instance.Query_Topology_FindPositionsPlaceable(); timeLastQuery = DateTime.MinValue; });
AddButton("Large positions sittable", Panels.Topology, () => { SpaceVisualizer.Instance.Query_Topology_FindLargePositionsSittable(); timeLastQuery = DateTime.MinValue; });

// Shape queries
ButtonPanels[(int)Panels.Shapes].Button.GetComponentInChildren<Text>().text = "Shape Queries";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ public static extern int QueryTopology_FindPositionsSittable(
[In] float minFacingClearance,
[In] int locationCount, // Pass in the space allocated in locationData
[In, Out] IntPtr locationData); // TopologyResult
}

/// <summary>
/// Finds only large spaces on platforms meeting the criteria specified by the parameters.
/// </summary>
/// <param name="minHeight">Minimum height above the floor for a space</param>
/// <param name="maxHeight">Maximum height above the floor for a space</param>
/// <param name="minFacingClearance">Minimum clearance for the space above the placement surface (minimum space height)</param>
/// <param name="minWidth">Minimum required width on placement surface</param>
/// <param name="locationCount">Number of location results supplied by the user in locationData</param>
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
[DllImport("SpatialUnderstanding")]
public static extern int QueryTopology_FindLargePositionsSittable(
[In] float minHeight,
[In] float maxHeight,
[In] float minFacingClearance,
[In] float minWidth,
[In] int locationCount, // Pass in the space allocated in locationData
[In, Out] IntPtr locationData); // TopologyResult
}

}

0 comments on commit da3116b

Please sign in to comment.