Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-15 08:23:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-15 08:23:23 +0400
commit57372f4ef8fcf428d7f38faca8e9b4299c28a4ce (patch)
treec00ccea8ae7d001cddabe856dc7ee92dfbe3d3ba /source/blender/blenkernel/intern/curve.c
parent716430ab64ef0ed400106bc501d444d38301aec6 (diff)
Curve: use zero length array for BevList for less confusing syntax
Diffstat (limited to 'source/blender/blenkernel/intern/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index b8ea7fec609..f87f686e81a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1855,7 +1855,7 @@ static bool bevelinside(BevList *bl1, BevList *bl2)
/* take first vertex of possible hole */
- bevp = (BevPoint *)(bl2 + 1);
+ bevp = bl2->bevpoints;
hvec1[0] = bevp->vec[0];
hvec1[1] = bevp->vec[1];
hvec1[2] = 0.0;
@@ -1865,7 +1865,7 @@ static bool bevelinside(BevList *bl1, BevList *bl2)
/* test it with all edges of potential surounding poly */
/* count number of transitions left-right */
- bevp = (BevPoint *)(bl1 + 1);
+ bevp = bl1->bevpoints;
nr = bl1->nr;
prevbevp = bevp + (nr - 1);
@@ -2051,7 +2051,7 @@ static void bevel_list_calc_bisect(BevList *bl)
bool is_cyclic = bl->poly != -1;
if (is_cyclic) {
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
nr = bl->nr;
@@ -2065,7 +2065,7 @@ static void bevel_list_calc_bisect(BevList *bl)
* of direction for this guys.
*/
- bevp0 = (BevPoint *)(bl + 1);
+ bevp0 = bl->bevpoints;
bevp1 = bevp0 + 1;
bevp2 = bevp1 + 1;
@@ -2086,7 +2086,7 @@ static void bevel_list_flip_tangents(BevList *bl)
BevPoint *bevp2, *bevp1, *bevp0;
int nr;
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2107,7 +2107,7 @@ static void bevel_list_apply_tilt(BevList *bl)
int nr;
float q[4];
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
nr = bl->nr;
@@ -2131,7 +2131,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
int a;
for (a = 0; a < smooth_iter; a++) {
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2177,7 +2177,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
static void make_bevel_list_3D_zup(BevList *bl)
{
- BevPoint *bevp = (BevPoint *)(bl + 1);
+ BevPoint *bevp = bl->bevpoints;
int nr = bl->nr;
bevel_list_calc_bisect(bl);
@@ -2212,7 +2212,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
bevel_list_calc_bisect(bl);
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2250,7 +2250,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
BevPoint *bevp_last;
- bevp_first = (BevPoint *)(bl + 1);
+ bevp_first = bl->bevpoints;
bevp_first += bl->nr - 1;
bevp_last = bevp_first;
bevp_last--;
@@ -2278,7 +2278,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
if (angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
angle = -angle;
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2300,11 +2300,11 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
* using it's own direction, which might not correspond
* the twist of neighbor point.
*/
- bevp1 = (BevPoint *)(bl + 1);
+ bevp1 = bl->bevpoints;
bevp0 = bevp1 + 1;
minimum_twist_between_two_points(bevp1, bevp0);
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
minimum_twist_between_two_points(bevp1, bevp0);
@@ -2322,7 +2322,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
bevel_list_flip_tangents(bl);
/* correct the tangents */
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2340,7 +2340,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
/* now for the real twist calc */
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
@@ -2387,7 +2387,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
{
float q[4];
- BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp2 = bl->bevpoints;
BevPoint *bevp1 = bevp2 + 1;
/* simple quat/dir */
@@ -2406,7 +2406,7 @@ static void make_bevel_list_segment_3D(BevList *bl)
/* only for 2 points */
static void make_bevel_list_segment_2D(BevList *bl)
{
- BevPoint *bevp2 = (BevPoint *)(bl + 1);
+ BevPoint *bevp2 = bl->bevpoints;
BevPoint *bevp1 = bevp2 + 1;
const float x1 = bevp1->vec[0] - bevp2->vec[0];
@@ -2429,13 +2429,13 @@ static void make_bevel_list_2D(BevList *bl)
int nr;
if (bl->poly != -1) {
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
bevp1 = bevp2 + (bl->nr - 1);
bevp0 = bevp1 - 1;
nr = bl->nr;
}
else {
- bevp0 = (BevPoint *)(bl + 1);
+ bevp0 = bl->bevpoints;
bevp1 = bevp0 + 1;
bevp2 = bevp1 + 1;
@@ -2467,14 +2467,14 @@ static void make_bevel_list_2D(BevList *bl)
float angle;
/* first */
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0;
bevp->sina = sinf(angle);
bevp->cosa = cosf(angle);
vec_to_quat(bevp->quat, bevp->dir, 5, 1);
/* last */
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
bevp += (bl->nr - 1);
angle = atan2(bevp->dir[0], bevp->dir[1]) - M_PI / 2.0;
bevp->sina = sinf(angle);
@@ -2489,7 +2489,7 @@ static void bevlist_firstlast_direction_calc_from_bpoint(Nurb *nu, BevList *bl)
BPoint *first_bp = nu->bp, *last_bp = nu->bp + (nu->pntsu - 1);
BevPoint *first_bevp, *last_bevp;
- first_bevp = (BevPoint *)(bl + 1);
+ first_bevp = bl->bevpoints;
last_bevp = first_bevp + (bl->nr - 1);
sub_v3_v3v3(first_bevp->dir, (first_bp + 1)->vec, first_bp->vec);
@@ -2570,7 +2570,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bl->nr = len;
bl->dupe_nr = 0;
bl->charidx = nu->charidx;
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
bp = nu->bp;
while (len--) {
@@ -2595,7 +2595,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
bl->charidx = nu->charidx;
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
a = nu->pntsu - 1;
bezt = nu->bezt;
@@ -2689,7 +2689,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bl->dupe_nr = 0;
bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
bl->charidx = nu->charidx;
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
BKE_nurb_makeCurve(nu, &bevp->vec[0],
do_tilt ? &bevp->alfa : NULL,
@@ -2712,11 +2712,11 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
bool is_cyclic = bl->poly != -1;
nr = bl->nr;
if (is_cyclic) {
- bevp1 = (BevPoint *)(bl + 1);
+ bevp1 = bl->bevpoints;
bevp0 = bevp1 + (nr - 1);
}
else {
- bevp0 = (BevPoint *)(bl + 1);
+ bevp0 = bl->bevpoints;
bevp1 = bevp0 + 1;
}
nr--;
@@ -2745,8 +2745,8 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
blnew->nr = 0;
BLI_remlink(bev, bl);
BLI_insertlinkbefore(bev, blnext, blnew); /* to make sure bevlijst is tuned with nurblist */
- bevp0 = (BevPoint *)(bl + 1);
- bevp1 = (BevPoint *)(blnew + 1);
+ bevp0 = bl->bevpoints;
+ bevp1 = blnew->bevpoints;
nr = bl->nr;
while (nr--) {
if (bevp0->dupe_tag == 0) {
@@ -2782,7 +2782,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
if (bl->poly > 0) {
min = 300000.0;
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
nr = bl->nr;
while (nr--) {
if (min > bevp->vec[0]) {
@@ -2794,14 +2794,14 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
sd->bl = bl;
sd->left = min;
- bevp = (BevPoint *)(bl + 1);
+ bevp = bl->bevpoints;
if (bevp1 == bevp)
bevp0 = bevp + (bl->nr - 1);
else
bevp0 = bevp1 - 1;
bevp = bevp + (bl->nr - 1);
if (bevp1 == bevp)
- bevp2 = (BevPoint *)(bl + 1);
+ bevp2 = bl->bevpoints;
else
bevp2 = bevp1 + 1;
@@ -2840,7 +2840,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
for (a = 0; a < poly; a++, sd++) {
if (sd->bl->hole == sd->dir) {
bl = sd->bl;
- bevp1 = (BevPoint *)(bl + 1);
+ bevp1 = bl->bevpoints;
bevp2 = bevp1 + (bl->nr - 1);
nr = bl->nr / 2;
while (nr--) {
@@ -2859,7 +2859,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
/* 2D Curves */
for (bl = bev->first; bl; bl = bl->next) {
if (bl->nr < 2) {
- BevPoint *bevp = (BevPoint *)(bl + 1);
+ BevPoint *bevp = bl->bevpoints;
unit_qt(bevp->quat);
}
else if (bl->nr == 2) { /* 2 pnt, treat separate */
@@ -2874,7 +2874,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
/* 3D Curves */
for (bl = bev->first; bl; bl = bl->next) {
if (bl->nr < 2) {
- BevPoint *bevp = (BevPoint *)(bl + 1);
+ BevPoint *bevp = bl->bevpoints;
unit_qt(bevp->quat);
}
else if (bl->nr == 2) { /* 2 pnt, treat separate */