FindSurface Response from Web

By requested URL, FindSurface server provides two types of response, one is binary format and another one is JSON format.

2. HTTP Response JSON Format

2.1 HTTP Response Header

Required Fields

Header Name Header Value
Content-Type application/json[; charset=utf-8]

2.2 HTTP Response Body Format

Response body is composed of following JSON string.

{
	"header" : "FSWEB",
	"version": "1.0",
	"code"   : (number),
	"result" : (object | string)
}

2.2.1. "code" values

The number type "code" can have following values: If the "code" value is not zero, you can get the corresponding message from "result". Otherwise, you can get surface parameters through "result" variable.

2.2.2. "result" Description

If the "code" value is non-zero, the "result" is describing the corresponding "code" case.

If the "code" value is zero, the "result" is the object type that describes the result of FindSurface. The result object format is same as below,

{
	"type"  : (string),
	"rms"   : (number),
	"param" : (object),
	"flags" : (null | array)
}
type string
Specifies the feature type of which FindSurface has found. One of [ "plane", "sphere", "cylinder", "cone", "torus" ] value will be assigned.
rms number
Resultant RMS fit error of the inliers.
param object

Specifies the surface parameters according to "type" value.

Case 1. plane
{
	"ll" : [ (number), (number), (number) ], 
	"lr" : [ (number), (number), (number) ],
	"ur" : [ (number), (number), (number) ], 
	"ul" : [ (number), (number), (number) ], 
	"c"  : [ (number), (number), (number) ], 
	"n"  : [ (number), (number), (number) ] 
}
ll [ x, y, z ]
The coordinates of lower left corner.
lr [ x, y, z ]
The coordinates of lower right corner.
ur [ x, y, z ]
The coordinates of upper right corner.
ul [ x, y, z ]
The coordinates of upper left corner.
c [ x, y, z ]
The coordinates of center of the plane.
n [ x, y, z ]
The normal vector of the plane.
Case 2. sphere
{
	"c" : [ (number), (number), (number) ], 
	"r" : (number) 
}
c [ x, y, z ]
The coordinates of center of the sphere.
r number
The radius of the sphere.
Case 3. cylinder
{
	"t" : [ (number), (number), (number) ], 
	"b" : [ (number), (number), (number) ],
	"r" : (number),
	"c" : [ (number), (number), (number) ], 
	"h" : (number),
	"n" : [ (number), (number), (number) ] 
}
t [ x, y, z ]
The coordinates of center of top circle.
b [ x, y, z ]
The coordinates of center of bottom circle.
r number
The radius of the cylinder.
c [ x, y, z ]
The coordinates of center of the cylinder.
h number
The height of the cylinder.
n [ x, y, z ]
The normalized axis vector (bottom to top) of the cylinder.
Case 4. cone
{
	"t"  : [ (number), (number), (number) ], 
	"tr" : (number),
	"b"  : [ (number), (number), (number) ],
	"br" : (number),
	"c" : [ (number), (number), (number) ], 
	"h" : (number),
	"n" : [ (number), (number), (number) ] 
}
t [ x, y, z ]
The coordinates of center of top circle.
tr number
The radius of top (smaller) circle.
b [ x, y, z ]
The coordinates of center of bottom circle.
br number
The radius of bottom (larger) circle.
c [ x, y, z ]
The coordinates of center of the cone.
h number
The height of the cone.
n [ x, y, z ]
The normalized axis vector (bottom to top) of the cone.
Case 5. torus
{
	"c"  : [ (number), (number), (number) ], 
	"n"  : [ (number), (number), (number) ], 
	"mr" : (number),
	"tr" : (number)  
}
c [ x, y, z ]
The coordinates of center of the torus.
n [ x, y, z ]
The normalized axis vector of the torus.
mr number
The mean radius.
tr number
The tube (circle) radius.
flags null | array

Array of Inlier & Outlier flag. Each flag has a number value indicating Inlier or Outlier.

Most of the cases this value is null, unless you specify an option flag for [Request Inlier & Outlier Flags] on request.

An index order of this array is same as Array of Point Attributes on the requested body. The i th flag indicates whether the i th point in the requested body is an inlier or an outlier. The outliers may be used as the new Point Attributes array in the next requested body to be sent.

2.3 HTTP Response Example

Example 1

Case) When FindSurface has been failed with "Not Found" error.

{
	"header" : "FSWEB",
	"version": "1.0",
	"code"   : 1,
	"result" : "Not found"
}

Example 2

Case) When FindSurface has been succeeded to find a Plane.

{ 
	"haeder"  : "FSWEB", 
	"version" : "1.0", 
	"code"    : 0, 
	"result"  : {
		"type"  : "plane", 
		"rms"   : 0.001772, 
		"param" : { 
			"ll": [ -0.5081, -0.4793, -1.556 ], 
			"lr": [ 0.869, -0.5044, -1.65 ], 
			"ur": [ 0.9165, 0.3334, -1.178 ], 
			"ul": [ -0.4606, 0.3584, -1.083 ], 
			"c" : [ 0.2042, -0.07297, -1.367 ], 
			"n" : [ 0.05042, -0.4928, 0.8687 ] 
		},
		"flags" : null 
	} 
}