BRL-CAD
nurb_knot.c File Reference
#include "common.h"
#include <math.h>
#include "bio.h"
#include "vmath.h"
#include "raytrace.h"
#include "nurb.h"
Include dependency graph for nurb_knot.c:

Go to the source code of this file.

Functions

void rt_nurb_kvknot (register struct knot_vector *new_knots, int order, fastf_t lower, fastf_t upper, int num, struct resource *res)
 
void rt_nurb_kvmult (struct knot_vector *new_kv, const struct knot_vector *kv, int num, register fastf_t val, struct resource *res)
 
void rt_nurb_kvgen (register struct knot_vector *kv, fastf_t lower, fastf_t upper, int num, struct resource *res)
 
void rt_nurb_kvmerge (struct knot_vector *new_knots, const struct knot_vector *kv1, const struct knot_vector *kv2, struct resource *res)
 
int rt_nurb_kvcheck (fastf_t val, register const struct knot_vector *kv)
 
void rt_nurb_kvextract (struct knot_vector *new_kv, register const struct knot_vector *kv, int lower, int upper, struct resource *res)
 
void rt_nurb_kvcopy (struct knot_vector *new_kv, register const struct knot_vector *old_kv, struct resource *res)
 
void rt_nurb_kvnorm (register struct knot_vector *kv)
 
int rt_nurb_knot_index (const struct knot_vector *kv, fastf_t k_value, int order)
 
void rt_nurb_gen_knot_vector (register struct knot_vector *new_knots, int order, fastf_t lower, fastf_t upper, struct resource *res)
 

Detailed Description

Various knot vector routines.

Definition in file nurb_knot.c.

Function Documentation

void rt_nurb_kvknot ( register struct knot_vector *  new_knots,
int  order,
fastf_t  lower,
fastf_t  upper,
int  num,
struct resource res 
)

rt_nurb_kvknot()

Generate a open knot vector with n=order knots at the beginning of the sequence and n knots at the end of the sequence with a lower, and an upper value and num knots in between

Definition at line 47 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by interpolate_data(), nmg_edge_g_cnurb(), rt_nurb_cinterp(), rt_nurb_plot(), and rt_nurb_sinterp().

Here is the call graph for this function:

void rt_nurb_kvmult ( struct knot_vector *  new_kv,
const struct knot_vector *  kv,
int  num,
register fastf_t  val,
struct resource res 
)

rt_nurb_kvmult()

Construct a new knot vector which is the same as the passed in knot vector except it has multiplicity of num of val. It checks to see if val already is a multiple knot.

Definition at line 83 of file nurb_knot.c.

References bu_bomb(), bu_free(), bu_log(), bu_malloc(), RT_CK_RESOURCE, rt_nurb_kvcheck(), rt_nurb_kvmerge(), and rt_nurb_pr_kv().

Referenced by rt_nurb_c_split(), rt_nurb_c_xsplit(), rt_nurb_s_split(), and rt_nurb_s_xsplit().

Here is the call graph for this function:

void rt_nurb_kvgen ( register struct knot_vector *  kv,
fastf_t  lower,
fastf_t  upper,
int  num,
struct resource res 
)

rt_nurb_kvgen()

Generate a knot vector with num knots from lower value to the upper value.

Definition at line 121 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by nmg_snurb_to_vlist().

Here is the call graph for this function:

void rt_nurb_kvmerge ( struct knot_vector *  new_knots,
const struct knot_vector *  kv1,
const struct knot_vector *  kv2,
struct resource res 
)

rt_nurb_kvmerge()

Merge two knot vectors together and return the new resulting knot vector.

Definition at line 147 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by nmg_snurb_to_vlist(), and rt_nurb_kvmult().

Here is the call graph for this function:

int rt_nurb_kvcheck ( fastf_t  val,
register const struct knot_vector *  kv 
)

rt_nurb_kvcheck()

Checks to see if the knot (val) exists in the Knot Vector and returns its multiplicity.

Definition at line 181 of file nurb_knot.c.

References ZERO.

Referenced by rt_nurb_kvmult().

void rt_nurb_kvextract ( struct knot_vector *  new_kv,
register const struct knot_vector *  kv,
int  lower,
int  upper,
struct resource res 
)

rt_nurb_kvextract()

Extract the portion of the knot vector from kv->knots[lower] to kv->knots[upper]

Definition at line 202 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by rt_nurb_c_split(), rt_nurb_c_xsplit(), rt_nurb_s_split(), and rt_nurb_s_xsplit().

Here is the call graph for this function:

void rt_nurb_kvcopy ( struct knot_vector *  new_kv,
register const struct knot_vector *  old_kv,
struct resource res 
)

rt_nurb_kvcopy()

Generic copy the knot vector and pass a new one in.

Definition at line 227 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by rt_nurb_s_refine(), rt_nurb_s_split(), and rt_nurb_s_xsplit().

Here is the call graph for this function:

void rt_nurb_kvnorm ( register struct knot_vector *  kv)

rt_nurb_kvnorm()

Normalize the knot vector so its values are from zero to one.

XXX Need to check to see if the lower value is zero

Definition at line 251 of file nurb_knot.c.

References ZERO.

Referenced by rt_nurb_import4(), and rt_nurb_import5().

int rt_nurb_knot_index ( const struct knot_vector *  kv,
fastf_t  k_value,
int  order 
)

knot_index()

Calculates and returns the index of the value for the knot vector

XXX It is hard to know what tolerance to use here for the comparisons.

Definition at line 275 of file nurb_knot.c.

References ZERO.

Referenced by rt_nurb_c_eval(), and rt_nurb_s_eval().

void rt_nurb_gen_knot_vector ( register struct knot_vector *  new_knots,
int  order,
fastf_t  lower,
fastf_t  upper,
struct resource res 
)

rt_nurb_gen_knot_vector()

Generate a open knot vector with n=order knots at the beginning of the sequence and n knots at the end of the sequence.

Definition at line 318 of file nurb_knot.c.

References bu_malloc(), and RT_CK_RESOURCE.

Referenced by nmg_cnurb_to_vlist().

Here is the call graph for this function: