|
@@ -74,7 +74,7 @@ unsigned int studio_line_c_size(const studio_line_c *line)
|
|
|
return line->size;
|
|
|
}
|
|
|
|
|
|
-// 获取指定位置的点的引用 (注意索引越界问题)
|
|
|
+
|
|
|
studio_point_c studio_line_c_get_point(const studio_line_c *line, unsigned int index)
|
|
|
{
|
|
|
studio_point_c tmp;
|
|
@@ -83,9 +83,22 @@ studio_point_c studio_line_c_get_point(const studio_line_c *line, unsigned int i
|
|
|
tmp = line->data[index];
|
|
|
return tmp;
|
|
|
}
|
|
|
- return tmp; // 越界返回空指针
|
|
|
+ return tmp; // 越界返回0,0点
|
|
|
}
|
|
|
|
|
|
+bool studio_line_c_set_point(studio_line_c *line, unsigned int index, studio_point_c point)
|
|
|
+{
|
|
|
+ bool status = false;
|
|
|
+ if (index > line->size)
|
|
|
+ {
|
|
|
+ return status;
|
|
|
+ }
|
|
|
+ line->data[index] = point;
|
|
|
+ status = true;
|
|
|
+ return status;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
////////////// 矩形 //////////////
|
|
|
|
|
|
studio_rect_c studio_rect_init(double l, double t, double r, double b)
|