PK_BODY_make_lofted_body   


PK_ERROR_code_t                     PK_BODY_make_lofted_body
(
--- received arguments ---
int                                 n_profiles,      --- number of profiles
const PK_BODY_t                     profiles[],      --- profiles to loft
const PK_VERTEX_t                   start_vertices[],--- start vertices
const PK_BODY_make_lofted_body_o_t *options,         --- options on lofting

--- returned arguments ---
PK_BODY_tracked_loft_r_t     *const lofted_body      --- result lofted body
)


This function creates a sheet or solid body based on surfaces created by
lofting through a set of sheet, wire or minimum body profiles.


Specific Errors:
    PK_ERROR_bad_type               One of the profiles in the list is of the
                                    incorrect type.

    PK_ERROR_bad_value              Incorrect number of profiles provided
                                    for lofting, or one of the profiles has
                                    unsuitable geometric properties.

                                    This may also indicate an unsuitable
                                    value has been specified for the
                                    simplification flag.

    PK_ERROR_bad_profile_matching   The vertex matching information couldn't
                                    be incorporated into a non-intersecting
                                    collection of curves interpolating
                                    vertices along the loft direction.

                                    This is also used to indicate a guide
                                    wire mismatch with the profiles due to
                                    a conflict with the vertex matching or
                                    the guide wire not being oriented.

    PK_ERROR_bad_end_conditions     The derivative conditions on at least
                                    one end of the loft did not provide a
                                    clear or complete description of the
                                    derivatives required.

    PK_ERROR_loft_failed            PK_BODY_make_lofted_body suffered an
                                    internal algorithmic failure




Introduction
This function receives an array of profiles and constructs a body
through them. The shape and structure of the lofted body can be
modified via the following controls within the option structure :

    o End conditions
    o Intermediate conditions
    o Guide wires
    o Vertex matching
    o Geometry simplification
    o Topological structure

The user is informed of the result of the loft operation via a returned
results structure which contains the resultant lofted body, tracking and
error information.


Profile Specification
Profiles for the lofting operation may be specified as a combination of
minimum, wire and sheet bodies. The following points need to be considered
when specifying the different types of profiles :

  Minimum or Degenerate Point Profiles
    o Minimum body profiles are used to represent degenerate point profiles.
    o Degenerate point profiles may only be specified as start and/or end
      lofting profiles.
    o At least one of the profiles must not be a degenerate point profile.
  

  Wire Profiles
    o Wire profiles must be oriented (PK_EDGE_propagate_orientation may
      be used to achieve this).
    o Wire profiles must only represent a single wire; disjoint wire
      profiles are not permitted.
    o Wire profiles must have at least one vertex.
    o Wire profiles may be open or closed profiles :
        o The start vertex on an open profile is assumed to be the first
          vertex of the profile.
        o The start for a closed profile must be specified in the
          corresponding entry of the array passed in the start_vertices
          argument.
  

  Sheet Profiles
  The following restrictions are imposed on sheet profiles :
        o The sheet profile must only have one loop of laminar edges.
        o The normals of the faces of the sheet profile must be oriented
          in the same direction as the loft direction. A sheet profile body
          can be "reversed" via the function, PK_BODY_reverse_orientation.
        o A sheet profile is considered to be a closed profile.
        o There is a limit to the number of sheet profiles that can be
          specified for a lofting operation :
            o For non-periodic lofts, only two sheet profiles may be
              specified. The two sheet profiles must form the start and
              end profiles of the loft.
            o For periodic lofts, only one sheet profile may be
              specified. The single sheet profile must be the first
              profile.
        o The laminar boundary of the sheet profile must have at least one
          vertex.
  

  Open and Closed Profiles
  The following restrictions apply to the open/closed nature of the input
  profiles :
    o The profiles must be either all open, or all closed.
    o A degenerate point profile will be considered to be open or closed
      depending on the closure of the non-degenerate profiles in the input
      array.
  

  Periodic Loft
  Where the loft is intended to return periodically to the start profile
  this will be indicated by setting the periodicity flag in the end conditions
  rather than repeating the start profile at the end of the array of profiles.


Resultant Lofted Body
The type of the resultant lofted body depends on the type and combination
of profiles input to the function. The resultant body may be either a sheet
or solid body.

  Resultant Sheet Body
  A sheet body will be created by the lofting operation in the following
  situations :
    o All the profiles are open wire and degenerate point profiles.
    o All the profiles are closed wire profiles.
    o The start profile of a periodic loft is a wire profile.
  
  The faces of the resultant sheet body will be constructed so that the
  outward normal is aligned with the cross product of :
        o The tangent in the direction of the profile orientation.
        o The loft direction.
  

  Resultant Solid Body
  A solid body will be created by the lofting operation in the following
  situations :
    o The end profiles are either sheet or degenerate point profiles and
      the intermediate profiles are closed wire profiles.
    o The start profile of a periodic loft is a sheet profile.

In both cases, sheet and solid body, none of the received profile topology
or geometry is incorporated into the body that is the result of the loft.
However end profiles that are sheets will be copied, and appropriate parts
of these copies will form part of the resultant body.


Loft Shape Controls
The shape of the resultant loft body can be modified via the shape controls
within the function's option structure.

 Loft End Conditions
 The end conditions of the loft can be specified via the end_conditions
 field within the options structure. These conditions provide constraints
 on the derivatives of the loft surface in the loft direction. The constraints
 are in three parts:
 
    o A periodicity flag held in the periodic field which is set to
      PK_PARAM_periodic_yes_c if and only if the loft is to produce
      surfaces which are periodic at the start profile.
 
    o Constraints on the derivatives at the start profile provided in
      the start field.
 
    o Constraints on the derivatives at the end profile provided in the
      end field, if the loft is not periodic. If the loft is periodic,
      these constraints are ignored.
 
 Details of the derivative contraints that may be applied are to be found in
 the documentation of the PK_BODY_loft_deriv_conds_t structure.

 Intermediate Loft Conditions
 For any profile other than the start or end, the derivative conditions may be
 specified by a paired array.
 
    o n_intermediate_derivs specifies the number of intermediate profiles
      that are to have derivative constraints specified. Note that this may be
      less than the total number of intermediate profiles (n_profiles-2 for
      non-periodic lofting, or n_profiles-1 for periodic lofting).
 
    o intermediate_derivs and intermediate_profiles are arrays of length
      n_intermediate_derivs. Each entry in intermediate_derivs specifies a
      constraint on the derivative at the profile indexed by the corresponding
      entry in intermediate_profiles (the first intermediate profile will be
      1, so each entry must be an int between 1 and n_profiles-2 for
      non-periodic lofting, or n_profiles-1 for periodic lofting). Any
      intermediate profile that is not specified in this array will have no
      derivative constraints applied there.
      intermediate_derivs and intermediate_profiles may be set to NULL,
      only if n_intermediate_derivs equals 0.

 Guide Wires
 By specifying guide wires in the options structure, you can constrain the
 loft geometry across profiles, resulting in a lofted body that follows the
 shape described by the guide wires at the relevant points. Guide wires must be
 G1-continuous, and must intersect every profile once only at corresponding
 vertices. Derivative constraints may also be specified on a guide wire, which
 constrain the derivatives across the loft surface.
 
    o n_guide_wires specifies the number of guide wires.
 
    o guide_wires specifies the guide wires, and must be an array of length
      n_guide_wires. It may be set to NULL only if n_guide_wires equals 0.
 
    o n_guide_derivs specifies the number of guide wires with derivative
      constraints. It must be between 0 and n_guide_wires inclusive.
 
    o guide_derivs and guide_indices are arrays of length n_guide_derivs.
      Each entry in guide_derivs specifies a constraint on the derivative at
      the guide wire indexed by the corresponding entry in guide_indices (so
      each entry must be an int between 0 and n_guide_wires-1). Any guide
      wire that is not specified in this array will have no derivative
      constraints applied there. guide_derivs and guide_indices may be set
      to NULL, only if n_guide_derivs equals 0.

 Profile Vertex Matching
 The profiles need to be matched to their neighbouring profiles in order
 to fully define the loft. By default, the function will attempt to match
 the profiles.
 
 If all the profiles contain the same number of vertices, the
 vertices will be mapped one-to-one across the profiles. All the
 start vertices will be matched with each other, then subsequent
 vertices on each profile will be matched in order.
 
 If the profiles contain different number of vertices, then either:
 
    o extra vertices must be added to some of the profiles using
      PK_EDGE_imprint_point to ensure the profiles contain the same number
      of vertices, or
    o a mapping between vertices across the profiles must be provided
      using the structures provided in the 'matches' field of the
      PK_BODY_loft_matches_t structure.  The mapping information is
      specified as a collection of vertex mappings between pairs of
      neighbouring profiles.
 
 If matching information is specified, then the following should be noted:
 
    o All matching information must be specified. I.e. all vertices on all
      the loft profiles must be matched.
    o The matching information can be specified in any order.
    o For a periodic loft, the first profile's vertices must be matched with
      two sets of profile's vertices : the second profile and the last profile.
    o Vertices that appear more than once are taken to indicate what amounts
      to the insertion of a degenerate section at that vertex into the profile
      in which they lie.
 
 Details of the representation of the map can be found in the documentation on:
 PK_BODY_loft_matches_t, PK_BODY_profile_match_t, and PK_BODY_loft_one_match_t
 
 For more information on matching profiles, see "Matching" in the
 "Advanced Surfacing" chapter of the Functional Description


Lofted Body Structure Controls
The structure of the resultant loft body can be modified via controls within
the function's option structure.

 Topological Structure of Lofted Body
 The topological structure of the resultant loft body may be controlled via
 the topology_form field within the option structure. The field may be set
 to one of the following values :
 
    o PK_BODY_topology_minimal_c: (default) The lofted body will have the
      minimum number of faces possible. Profile edges which meet smoothly
      may be lofted into a single face.
 
    o PK_BODY_topology_columns_c:  The lofted body will have one set of faces
      for each edge in the profile regardless of whether they are smoothly
      connected.
 
    o PK_BODY_topology_grid_c:  The lofted body will have n_profiles - 1
      faces (and n_profiles faces for a periodic loft) for each set of
      corresponding profile edges. All edges in the profiles will correspond
      to edges on the resultant lofted body.
 

 Geometry Simplification
 The simplification of the geometry of individual lofted faces may be
 attempted, depending on the value of the simplify field within the
 option structure. The field may be set to one of the following values :
 
    o PK_BODY_simplify_no_c: B-spline geometry will be used to represent
      the loft of all sections of the profiles.
 
    o PK_BODY_simplify_yes_c (default): The lofted surfaces may be replaced
      where the combination of loft profile geometries produces an analytic
      simplification of the loft. If the surface of a face is simplified,
      the edges of the face may be simplified as well.
 


Nominal Geometry on the Lofted Body
The resultant lofted body will always have nominal geometry enabled. The state
of the nominal geometry flag on the resultant lofted body can be enquired and
set via PK_BODY_ask_curve_nmnl_state and PK_BODY_set_curve_nmnl_state
respectively.

The edges in the resultant loft body which are copied from the input profiles
will have nominal geometry associated with them. The edges formed as a result
of the lofting operation (lateral edges) may have nominal geometry associated
with them.

The nominal geometry for an edge may be acquired via the functions,
PK_EDGE_ask_curve_nmnl and PK_EDGE_ask_geometry_nmnl.


Returned Tracking and Error Information
The resultant lofted body is returned in lofted_body as a structure
that packages it with associated status and tracking information.

The status information, in the status field of the returned structure, is
itself a structure that contains information on any failure to create the
lofted body. The type of fault occurred is indicated by the fault field.
The location of the error is given by a point and topology in the
fault_location and fault_topol fields respectively.


The tracking information relates topology prior to the operation, to topology
after it. Details of the structure of this information is given in the
documentation on PK_TOPOL_track_r_t.

This information will relate the geometric dependency of faces in the result
upon edges or faces in the received profiles. The tracking records
contain :

    o for each lateral face generated by lofting across edges :

        product_topols  is an array holding just that lateral face
        original_topols is the set of edges in the profiles that if
         modified would alter its geometry.

    o for each face in an end cap generated for a sheet profile

        product_topols  is an array holding just that end face
        original_topols is an array holding the single face in the original
         profile for which it is a transformed copy.

Topologies involved in many topological operations may appear in several
tracking records.