mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 20:02:49 +08:00
lstsq fix in circle fitting for old PyTorch
Summary: the pytorch3d.compat.lstsq function needs a 2D rhs. Reviewed By: patricklabatut Differential Revision: D36195826 fbshipit-source-id: 9dbafea2057035cc04973f56729dc97b47dcac83
This commit is contained in:
parent
44ca5f95d9
commit
44cb00e468
@ -106,9 +106,9 @@ def fit_circle_in_2d(
|
||||
n_provided = points2d.shape[0]
|
||||
if n_provided < 3:
|
||||
raise ValueError(f"{n_provided} points are not enough to determine a circle")
|
||||
solution = lstsq(design, rhs)
|
||||
center = solution[:2] / 2
|
||||
radius = torch.sqrt(solution[2] + (center ** 2).sum())
|
||||
solution = lstsq(design, rhs[:, None])
|
||||
center = solution[:2, 0] / 2
|
||||
radius = torch.sqrt(solution[2, 0] + (center ** 2).sum())
|
||||
if n_points > 0:
|
||||
if angles is not None:
|
||||
warnings.warn("n_points ignored because angles provided")
|
||||
|
Loading…
x
Reference in New Issue
Block a user